mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
feat(kubernetes): remove path and service from mandatory fields EE-5406 (#9054)
This commit is contained in:
parent
3721c1478e
commit
57fa044f2e
2 changed files with 48 additions and 21 deletions
|
@ -207,6 +207,14 @@ func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInf
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(rules) == 0 {
|
||||||
|
for _, host := range info.Hosts {
|
||||||
|
ingress.Spec.Rules = []netv1.IngressRule{{
|
||||||
|
Host: host,
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_, err := ingressClient.Create(context.Background(), &ingress, metav1.CreateOptions{})
|
_, err := ingressClient.Create(context.Background(), &ingress, metav1.CreateOptions{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -279,6 +287,14 @@ func (kcl *KubeClient) UpdateIngress(namespace string, info models.K8sIngressInf
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(rules) == 0 {
|
||||||
|
for _, host := range info.Hosts {
|
||||||
|
ingress.Spec.Rules = []netv1.IngressRule{{
|
||||||
|
Host: host,
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_, err := ingressClient.Update(context.Background(), &ingress, metav1.UpdateOptions{})
|
_, err := ingressClient.Update(context.Background(), &ingress, metav1.UpdateOptions{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,16 +308,6 @@ export function IngressForm({
|
||||||
{!host.NoHost ? 'Rule' : 'Fallback rule'}
|
{!host.NoHost ? 'Rule' : 'Fallback rule'}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-sm-9 p-0 text-right">
|
<div className="col-sm-9 p-0 text-right">
|
||||||
{!host.NoHost && (
|
|
||||||
<Button
|
|
||||||
className="btn btn-light btn-sm"
|
|
||||||
onClick={() => reloadTLSCerts()}
|
|
||||||
icon={RefreshCw}
|
|
||||||
>
|
|
||||||
Reload TLS secrets
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-sm ml-2"
|
className="btn btn-sm ml-2"
|
||||||
color="dangerlight"
|
color="dangerlight"
|
||||||
|
@ -367,11 +357,21 @@ export function IngressForm({
|
||||||
handleTLSChange(hostIndex, e.target.value)
|
handleTLSChange(hostIndex, e.target.value)
|
||||||
}
|
}
|
||||||
defaultValue={host.Secret}
|
defaultValue={host.Secret}
|
||||||
|
className="!rounded-r-none"
|
||||||
/>
|
/>
|
||||||
|
{!host.NoHost && (
|
||||||
|
<div className="input-group-btn">
|
||||||
|
<Button
|
||||||
|
className="btn btn-light btn-sm !ml-0 !rounded-l-none"
|
||||||
|
onClick={() => reloadTLSCerts()}
|
||||||
|
icon={RefreshCw}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-12 p-0">
|
<div className="col-sm-12 col-lg-4 flex h-[30px] items-center pl-2">
|
||||||
<TextTip color="blue">
|
<TextTip color="blue">
|
||||||
You may also use the{' '}
|
You may also use the{' '}
|
||||||
<Link
|
<Link
|
||||||
|
@ -401,6 +401,13 @@ export function IngressForm({
|
||||||
Paths
|
Paths
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p className="small text-muted mt-4">
|
||||||
|
By leaving service/path details blank, you can setup{' '}
|
||||||
|
<span>ingress defaults</span> that a user may select from via
|
||||||
|
the hostname dropdown in Create/Edit Application.
|
||||||
|
</p>
|
||||||
|
|
||||||
{host.Paths.map((path, pathIndex) => (
|
{host.Paths.map((path, pathIndex) => (
|
||||||
<div
|
<div
|
||||||
className="row path mt-5 !mb-5"
|
className="row path mt-5 !mb-5"
|
||||||
|
@ -408,9 +415,7 @@ 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 required">
|
<span className="input-group-addon">Service</span>
|
||||||
Service
|
|
||||||
</span>
|
|
||||||
<Select
|
<Select
|
||||||
key={serviceOptions.toString() + path.ServiceName}
|
key={serviceOptions.toString() + path.ServiceName}
|
||||||
name={`ingress_service_${hostIndex}_${pathIndex}`}
|
name={`ingress_service_${hostIndex}_${pathIndex}`}
|
||||||
|
@ -443,7 +448,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 required">
|
<span className="input-group-addon">
|
||||||
Service port
|
Service port
|
||||||
</span>
|
</span>
|
||||||
<Select
|
<Select
|
||||||
|
@ -526,7 +531,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 required">Path</span>
|
<span className="input-group-addon">Path</span>
|
||||||
<input
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
name={`ingress_route_${hostIndex}-${pathIndex}`}
|
name={`ingress_route_${hostIndex}-${pathIndex}`}
|
||||||
|
@ -559,13 +564,13 @@ export function IngressForm({
|
||||||
|
|
||||||
<div className="form-group col-sm-1 !m-0 !pl-0">
|
<div className="form-group col-sm-1 !m-0 !pl-0">
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-sm btn-only-icon vertical-center !ml-0"
|
className="btn-only-icon vertical-center !ml-0"
|
||||||
color="dangerlight"
|
color="dangerlight"
|
||||||
type="button"
|
type="button"
|
||||||
data-cy={`k8sAppCreate-rmPortButton_${hostIndex}-${pathIndex}`}
|
data-cy={`k8sAppCreate-rmPortButton_${hostIndex}-${pathIndex}`}
|
||||||
onClick={() => removeIngressRoute(hostIndex, pathIndex)}
|
onClick={() => removeIngressRoute(hostIndex, pathIndex)}
|
||||||
disabled={host.Paths.length === 1}
|
|
||||||
icon={Trash2}
|
icon={Trash2}
|
||||||
|
size="small"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -573,10 +578,12 @@ export function IngressForm({
|
||||||
|
|
||||||
<div className="row mt-5">
|
<div className="row mt-5">
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-sm btn-light !ml-0"
|
className="!ml-0"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => addNewIngressRoute(hostIndex)}
|
onClick={() => addNewIngressRoute(hostIndex)}
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
|
size="small"
|
||||||
|
color="default"
|
||||||
>
|
>
|
||||||
Add path
|
Add path
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -589,20 +596,24 @@ export function IngressForm({
|
||||||
<div className="row rules-action p-0">
|
<div className="row rules-action p-0">
|
||||||
<div className="col-sm-12 vertical-center p-0">
|
<div className="col-sm-12 vertical-center p-0">
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-sm btn-light !ml-0"
|
className="!ml-0"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => addNewIngressHost()}
|
onClick={() => addNewIngressHost()}
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
|
color="default"
|
||||||
|
size="small"
|
||||||
>
|
>
|
||||||
Add new host
|
Add new host
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="btn btn-sm btn-light ml-2"
|
className="ml-2"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => addNewIngressHost(true)}
|
onClick={() => addNewIngressHost(true)}
|
||||||
disabled={hasNoHostRule}
|
disabled={hasNoHostRule}
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
|
color="default"
|
||||||
|
size="small"
|
||||||
>
|
>
|
||||||
Add fallback rule
|
Add fallback rule
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue