Skip to content

Commit a3da2fe

Browse files
authored
Merge pull request #115 from gympass/bugfix
fix: panic on Ingresses with no HTTP field on rules
2 parents 9f8b5e6 + 737e523 commit a3da2fe

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
199199
.PHONY: envtest
200200
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
201201
$(ENVTEST): $(LOCALBIN)
202-
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
202+
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240208111015-5923139bc5bd
203203

204204
.PHONY: bundle
205205
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.

internal/k8s/ingress.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ func pathsForViewerFunction(ing *networkingv1.Ingress, fnARN string) []Path {
265265

266266
var paths []Path
267267
for _, rule := range rules {
268+
if rule.HTTP == nil {
269+
continue
270+
}
268271
for _, p := range rule.HTTP.Paths {
269272
newPath := Path{
270273
PathPattern: p.Path,
@@ -283,6 +286,9 @@ func pathsForFunctionAssociations(ctx context.Context, ing *networkingv1.Ingress
283286

284287
var paths []Path
285288
for _, rule := range rules {
289+
if rule.HTTP == nil {
290+
continue
291+
}
286292
for _, p := range rule.HTTP.Paths {
287293
newPath := Path{
288294
PathPattern: p.Path,

internal/k8s/validation.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func ValidateIngressFunctionAssociations(ing *networkingv1.Ingress) error {
5959
func ingressPaths(ing *networkingv1.Ingress) []string {
6060
var paths []string
6161
for _, r := range ing.Spec.Rules {
62+
if r.HTTP == nil {
63+
continue
64+
}
6265
for _, p := range r.HTTP.Paths {
6366
paths = append(paths, p.Path)
6467
}

0 commit comments

Comments
 (0)