Skip to content

Commit

Permalink
Merge pull request #115 from gympass/bugfix
Browse files Browse the repository at this point in the history
fix: panic on Ingresses with no HTTP field on rules
  • Loading branch information
LCaparelli authored Mar 27, 2024
2 parents 9f8b5e6 + 737e523 commit a3da2fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240208111015-5923139bc5bd

.PHONY: bundle
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
Expand Down
6 changes: 6 additions & 0 deletions internal/k8s/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ func pathsForViewerFunction(ing *networkingv1.Ingress, fnARN string) []Path {

var paths []Path
for _, rule := range rules {
if rule.HTTP == nil {
continue
}
for _, p := range rule.HTTP.Paths {
newPath := Path{
PathPattern: p.Path,
Expand All @@ -283,6 +286,9 @@ func pathsForFunctionAssociations(ctx context.Context, ing *networkingv1.Ingress

var paths []Path
for _, rule := range rules {
if rule.HTTP == nil {
continue
}
for _, p := range rule.HTTP.Paths {
newPath := Path{
PathPattern: p.Path,
Expand Down
3 changes: 3 additions & 0 deletions internal/k8s/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func ValidateIngressFunctionAssociations(ing *networkingv1.Ingress) error {
func ingressPaths(ing *networkingv1.Ingress) []string {
var paths []string
for _, r := range ing.Spec.Rules {
if r.HTTP == nil {
continue
}
for _, p := range r.HTTP.Paths {
paths = append(paths, p.Path)
}
Expand Down

0 comments on commit a3da2fe

Please sign in to comment.