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) {
|
||||
this.EndpointProvider = EndpointProvider;
|
||||
this.Authentication = Authentication;
|
||||
this.KubernetesApplicationPublishingTypes = KubernetesApplicationPublishingTypes;
|
||||
}
|
||||
|
||||
addPort() {
|
||||
const p = new KubernetesServicePort();
|
||||
p.nodePort = '';
|
||||
p.port = '';
|
||||
p.targetPort = '';
|
||||
p.protocol = 'TCP';
|
||||
const port = new KubernetesServicePort();
|
||||
port.nodePort = '';
|
||||
port.port = '';
|
||||
port.targetPort = '';
|
||||
port.protocol = 'TCP';
|
||||
|
||||
if (this.ingressType) {
|
||||
const r = new KubernetesIngressServiceRoute();
|
||||
r.ServiceName = this.serviceName;
|
||||
p.ingress = r;
|
||||
p.Ingress = true;
|
||||
const route = new KubernetesIngressServiceRoute();
|
||||
route.ServiceName = this.serviceName;
|
||||
|
||||
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) {
|
||||
|
@ -69,8 +81,6 @@ export default class KubeServicesItemViewController {
|
|||
this.addPort();
|
||||
}
|
||||
|
||||
this.KubernetesApplicationPublishingTypes = KubernetesApplicationPublishingTypes;
|
||||
|
||||
this.state = {
|
||||
duplicates: {
|
||||
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">
|
||||
<p style="margin-top: 10px">
|
||||
<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">
|
||||
<span class="input-group-addon">ingress</span>
|
||||
<select
|
||||
ng-init="servicePort.ingress.IngressName = $ctrl.originalIngresses[0].Name"
|
||||
class="form-control"
|
||||
name="ingress_port_{{ $index }}"
|
||||
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">
|
||||
<span class="input-group-addon">hostname</span>
|
||||
<select
|
||||
ng-init="servicePort.ingress.Host = $ctrl.originalIngresses[0].Hosts"
|
||||
class="form-control"
|
||||
name="hostname_port_{{ $index }}"
|
||||
ng-model="servicePort.ingress.Host"
|
||||
required
|
||||
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 }}"
|
||||
>
|
||||
<option selected disabled hidden value="">Select a hostname</option>
|
||||
|
@ -239,4 +237,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ng-form>
|
||||
|
|
Loading…
Reference in New Issue