fix fallback rule and wordings (#9074)

pull/9075/head
Prabhat Khera 1 year ago committed by GitHub
parent 79822e1d3b
commit 90759182db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -207,11 +207,13 @@ func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInf
}) })
} }
if len(rules) == 0 { // 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 { for _, host := range info.Hosts {
ingress.Spec.Rules = []netv1.IngressRule{{ if _, ok := rules[host]; !ok {
ingress.Spec.Rules = append(ingress.Spec.Rules, netv1.IngressRule{
Host: host, Host: host,
}} })
} }
} }
@ -287,11 +289,13 @@ func (kcl *KubeClient) UpdateIngress(namespace string, info models.K8sIngressInf
}) })
} }
if len(rules) == 0 { // 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 { for _, host := range info.Hosts {
ingress.Spec.Rules = []netv1.IngressRule{{ if _, ok := rules[host]; !ok {
ingress.Spec.Rules = append(ingress.Spec.Rules, netv1.IngressRule{
Host: host, Host: host,
}} })
} }
} }

@ -388,7 +388,7 @@ export function IngressForm({
</div> </div>
)} )}
{host.NoHost && ( {host.NoHost && (
<p className="vertical-center text-muted small col-sm-12 whitespace-nowrap !p-0"> <p className="vertical-center text-muted small col-sm-12 !p-0">
<Icon icon={Info} mode="primary" size="md" />A fallback rule <Icon icon={Info} mode="primary" size="md" />A fallback rule
has no host specified. This rule only applies when an has no host specified. This rule only applies when an
inbound request has a hostname that does not match with any inbound request has a hostname that does not match with any
@ -402,11 +402,13 @@ export function IngressForm({
</div> </div>
</div> </div>
{!host.Paths.length && (
<p className="small text-muted mt-4"> <p className="small text-muted mt-4">
By leaving service/path details blank, you can setup{' '} You may save the ingress without a path and it will then be
<span>ingress defaults</span> that a user may select from via an <b>ingress default</b> that a user may select via the
the hostname dropdown in Create/Edit Application. hostname dropdown in Create/Edit application.
</p> </p>
)}
{host.Paths.map((path, pathIndex) => ( {host.Paths.map((path, pathIndex) => (
<div <div
@ -415,7 +417,9 @@ export function IngressForm({
> >
<div className="form-group col-sm-3 col-xl-2 !m-0 !pl-0"> <div className="form-group col-sm-3 col-xl-2 !m-0 !pl-0">
<div className="input-group input-group-sm"> <div className="input-group input-group-sm">
<span className="input-group-addon">Service</span> <span className="input-group-addon required">
Service
</span>
<Select <Select
key={serviceOptions.toString() + path.ServiceName} key={serviceOptions.toString() + path.ServiceName}
name={`ingress_service_${hostIndex}_${pathIndex}`} name={`ingress_service_${hostIndex}_${pathIndex}`}
@ -448,7 +452,7 @@ export function IngressForm({
{servicePorts && ( {servicePorts && (
<> <>
<div className="input-group input-group-sm"> <div className="input-group input-group-sm">
<span className="input-group-addon"> <span className="input-group-addon required">
Service port Service port
</span> </span>
<Select <Select
@ -531,7 +535,7 @@ export function IngressForm({
<div className="form-group col-sm-3 col-xl-3 !m-0 !pl-0"> <div className="form-group col-sm-3 col-xl-3 !m-0 !pl-0">
<div className="input-group input-group-sm"> <div className="input-group input-group-sm">
<span className="input-group-addon">Path</span> <span className="input-group-addon required">Path</span>
<input <input
className="form-control" className="form-control"
name={`ingress_route_${hostIndex}-${pathIndex}`} name={`ingress_route_${hostIndex}-${pathIndex}`}
@ -571,6 +575,7 @@ export function IngressForm({
onClick={() => removeIngressRoute(hostIndex, pathIndex)} onClick={() => removeIngressRoute(hostIndex, pathIndex)}
icon={Trash2} icon={Trash2}
size="small" size="small"
disabled={host.Paths.length === 1 && host.NoHost}
/> />
</div> </div>
</div> </div>

Loading…
Cancel
Save