mirror of https://github.com/portainer/portainer
fix(k8s/app): populate ingress details [EE-2445] (#6463)
* fix(k8s/app): populate ingress details [EE-2445] fix [EE-2445] * fix(k8s/app): check if there are ingressespull/6488/head
parent
a9406764ee
commit
1fbf13e812
|
@ -9,22 +9,34 @@ export default class KubeServicesItemViewController {
|
||||||
constructor(EndpointProvider, Authentication) {
|
constructor(EndpointProvider, Authentication) {
|
||||||
this.EndpointProvider = EndpointProvider;
|
this.EndpointProvider = EndpointProvider;
|
||||||
this.Authentication = Authentication;
|
this.Authentication = Authentication;
|
||||||
|
this.KubernetesApplicationPublishingTypes = KubernetesApplicationPublishingTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPort() {
|
addPort() {
|
||||||
const p = new KubernetesServicePort();
|
const port = new KubernetesServicePort();
|
||||||
p.nodePort = '';
|
port.nodePort = '';
|
||||||
p.port = '';
|
port.port = '';
|
||||||
p.targetPort = '';
|
port.targetPort = '';
|
||||||
p.protocol = 'TCP';
|
port.protocol = 'TCP';
|
||||||
|
|
||||||
if (this.ingressType) {
|
if (this.ingressType) {
|
||||||
const r = new KubernetesIngressServiceRoute();
|
const route = new KubernetesIngressServiceRoute();
|
||||||
r.ServiceName = this.serviceName;
|
route.ServiceName = this.serviceName;
|
||||||
p.ingress = r;
|
|
||||||
p.Ingress = true;
|
if (this.serviceType === KubernetesApplicationPublishingTypes.CLUSTER_IP && this.originalIngresses.length > 0) {
|
||||||
|
if (!route.IngressName) {
|
||||||
|
route.IngressName = this.originalIngresses[0].Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!route.Host) {
|
||||||
|
route.Host = this.originalIngresses[0].Hosts[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
port.ingress = route;
|
||||||
|
port.Ingress = true;
|
||||||
}
|
}
|
||||||
this.servicePorts.push(p);
|
this.servicePorts.push(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
removePort(index) {
|
removePort(index) {
|
||||||
|
@ -69,8 +81,6 @@ export default class KubeServicesItemViewController {
|
||||||
this.addPort();
|
this.addPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.KubernetesApplicationPublishingTypes = KubernetesApplicationPublishingTypes;
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
duplicates: {
|
duplicates: {
|
||||||
targetPort: new KubernetesFormValidationReferences(),
|
targetPort: new KubernetesFormValidationReferences(),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form name="serviceForm">
|
<ng-form name="serviceForm">
|
||||||
<div ng-if="$ctrl.isAdmin()" class="small text-warning" ng-show="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.LOAD_BALANCER && !$ctrl.loadbalancerEnabled">
|
<div ng-if="$ctrl.isAdmin()" class="small text-warning" ng-show="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.LOAD_BALANCER && !$ctrl.loadbalancerEnabled">
|
||||||
<p style="margin-top: 10px">
|
<p style="margin-top: 10px">
|
||||||
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> No Load balancer is available in this cluster, click
|
<i class="fa fa-exclamation-circle" aria-hidden="true"></i> No Load balancer is available in this cluster, click
|
||||||
|
@ -92,7 +92,6 @@
|
||||||
<div ng-if="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.CLUSTER_IP && $ctrl.ingressType" class="input-group input-group-sm">
|
<div ng-if="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.CLUSTER_IP && $ctrl.ingressType" class="input-group input-group-sm">
|
||||||
<span class="input-group-addon">ingress</span>
|
<span class="input-group-addon">ingress</span>
|
||||||
<select
|
<select
|
||||||
ng-init="servicePort.ingress.IngressName = $ctrl.originalIngresses[0].Name"
|
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="ingress_port_{{ $index }}"
|
name="ingress_port_{{ $index }}"
|
||||||
ng-model="servicePort.ingress.IngressName"
|
ng-model="servicePort.ingress.IngressName"
|
||||||
|
@ -108,13 +107,12 @@
|
||||||
<div ng-if="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.CLUSTER_IP && $ctrl.ingressType" class="input-group input-group-sm">
|
<div ng-if="$ctrl.serviceType === $ctrl.KubernetesApplicationPublishingTypes.CLUSTER_IP && $ctrl.ingressType" class="input-group input-group-sm">
|
||||||
<span class="input-group-addon">hostname</span>
|
<span class="input-group-addon">hostname</span>
|
||||||
<select
|
<select
|
||||||
ng-init="servicePort.ingress.Host = $ctrl.originalIngresses[0].Hosts"
|
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="hostname_port_{{ $index }}"
|
name="hostname_port_{{ $index }}"
|
||||||
ng-model="servicePort.ingress.Host"
|
ng-model="servicePort.ingress.Host"
|
||||||
required
|
required
|
||||||
ng-disabled="$ctrl.originalIngresses.length === 0"
|
ng-disabled="$ctrl.originalIngresses.length === 0"
|
||||||
ng-options="ingress.Hosts as ingress.Hosts for ingress in $ctrl.originalIngresses"
|
ng-options="ingress.Hosts[0] as ingress.Hosts for ingress in $ctrl.originalIngresses"
|
||||||
data-cy="k8sAppCreate-hostnamePort_{{ $index }}"
|
data-cy="k8sAppCreate-hostnamePort_{{ $index }}"
|
||||||
>
|
>
|
||||||
<option selected disabled hidden value="">Select a hostname</option>
|
<option selected disabled hidden value="">Select a hostname</option>
|
||||||
|
@ -239,4 +237,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</ng-form>
|
||||||
|
|
Loading…
Reference in New Issue