Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
fix check correct ingress ref
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Sep 26, 2024
1 parent fca68ab commit a7e16f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kontrol-service/engine/flow/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ func RenderClusterResources(clusterTopology *resolved.ClusterTopology, namespace
targeIngressServices := lo.Uniq(
lo.FlatMap(clusterTopology.Ingress.Ingresses, func(ing net.Ingress, _ int) []string {
return lo.FlatMap(ing.Spec.Rules, func(rule net.IngressRule, _ int) []string {
return lo.Map(rule.HTTP.Paths, func(path net.HTTPIngressPath, _ int) string {
return lo.FilterMap(rule.HTTP.Paths, func(path net.HTTPIngressPath, _ int) (string, bool) {
// TODO: we are ignoring the namespace from the path, should we?
targetNS := namespace
if ing.Namespace != "" {
targetNS = string(ing.Namespace)
}
return fmt.Sprintf("%s/%s", targetNS, string(path.Backend.Resource.Name))
if path.Backend.Service == nil {
logrus.Errorf("Ingress %v has a nil backend service", ing.Name)
return "", false
}
return fmt.Sprintf("%s/%s", targetNS, string(path.Backend.Service.Name)), true
})
})
}))
Expand Down

0 comments on commit a7e16f1

Please sign in to comment.