diff --git a/api/kubernetes/cli/ingress.go b/api/kubernetes/cli/ingress.go index a0eb0402b..895ebd893 100644 --- a/api/kubernetes/cli/ingress.go +++ b/api/kubernetes/cli/ingress.go @@ -207,11 +207,13 @@ func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInf }) } - if len(rules) == 0 { - for _, host := range info.Hosts { - ingress.Spec.Rules = []netv1.IngressRule{{ + // Add rules for hosts that does not have paths. + // e.g. dafault ingress rule without path to support what we had in 2.15 + for _, host := range info.Hosts { + if _, ok := rules[host]; !ok { + ingress.Spec.Rules = append(ingress.Spec.Rules, netv1.IngressRule{ Host: host, - }} + }) } } @@ -287,11 +289,13 @@ func (kcl *KubeClient) UpdateIngress(namespace string, info models.K8sIngressInf }) } - if len(rules) == 0 { - for _, host := range info.Hosts { - ingress.Spec.Rules = []netv1.IngressRule{{ + // Add rules for hosts that does not have paths. + // e.g. dafault ingress rule without path to support what we had in 2.15 + for _, host := range info.Hosts { + if _, ok := rules[host]; !ok { + ingress.Spec.Rules = append(ingress.Spec.Rules, netv1.IngressRule{ Host: host, - }} + }) } } diff --git a/app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx b/app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx index 73407ef4a..0bae74d8c 100644 --- a/app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx +++ b/app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx @@ -388,7 +388,7 @@ export function IngressForm({ )} {host.NoHost && ( -
+
- By leaving service/path details blank, you can setup{' '} - ingress defaults that a user may select from via - the hostname dropdown in Create/Edit Application. -
+ {!host.Paths.length && ( ++ You may save the ingress without a path and it will then be + an ingress default that a user may select via the + hostname dropdown in Create/Edit application. +
+ )} {host.Paths.map((path, pathIndex) => (