diff --git a/app/kubernetes/converters/application.js b/app/kubernetes/converters/application.js index 97f257f95..a4b3406cf 100644 --- a/app/kubernetes/converters/application.js +++ b/app/kubernetes/converters/application.js @@ -261,7 +261,7 @@ class KubernetesApplicationConverter { return res; } - static applicationToFormValues(app, resourcePools, configurations, persistentVolumeClaims, nodesLabels) { + static applicationToFormValues(app, resourcePools, configurations, persistentVolumeClaims, nodesLabels, ingresses) { const res = new KubernetesApplicationFormValues(); res.ApplicationType = app.ApplicationType; res.ResourcePool = _.find(resourcePools, ['Namespace.Name', app.ResourcePool]); @@ -278,7 +278,7 @@ class KubernetesApplicationConverter { res.PersistedFolders = KubernetesApplicationHelper.generatePersistedFoldersFormValuesFromPersistedFolders(app.PersistedFolders, persistentVolumeClaims); // generate from PVC and app.PersistedFolders res.Configurations = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(app.Env, app.ConfigurationVolumes, configurations); res.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(app.AutoScaler, res.ReplicaCount); - res.PublishedPorts = KubernetesApplicationHelper.generatePublishedPortsFormValuesFromPublishedPorts(app.ServiceType, app.PublishedPorts); + res.PublishedPorts = KubernetesApplicationHelper.generatePublishedPortsFormValuesFromPublishedPorts(app.ServiceType, app.PublishedPorts, ingresses); res.Containers = app.Containers; const isIngress = _.filter(res.PublishedPorts, (p) => p.IngressName).length; diff --git a/app/kubernetes/helpers/application/index.js b/app/kubernetes/helpers/application/index.js index dd93beef7..82aa97c4e 100644 --- a/app/kubernetes/helpers/application/index.js +++ b/app/kubernetes/helpers/application/index.js @@ -274,7 +274,7 @@ class KubernetesApplicationHelper { /* #endregion */ /* #region PUBLISHED PORTS FV <> PUBLISHED PORTS */ - static generatePublishedPortsFormValuesFromPublishedPorts(serviceType, publishedPorts) { + static generatePublishedPortsFormValuesFromPublishedPorts(serviceType, publishedPorts, ingress) { const generatePort = (port, rule) => { const res = new KubernetesApplicationPublishedPortFormValue(); res.IsNew = false; @@ -282,6 +282,7 @@ class KubernetesApplicationHelper { res.IngressName = rule.IngressName; res.IngressRoute = rule.Path; res.IngressHost = rule.Host; + res.IngressHosts = ingress.find((i) => i.Name === rule.IngressName).Hosts; } res.Protocol = port.Protocol; res.ContainerPort = port.TargetPort; diff --git a/app/kubernetes/models/application/formValues.js b/app/kubernetes/models/application/formValues.js index 4d47a5ba5..6faffaeb6 100644 --- a/app/kubernetes/models/application/formValues.js +++ b/app/kubernetes/models/application/formValues.js @@ -124,6 +124,7 @@ export function KubernetesApplicationPublishedPortFormValue() { IngressName: undefined, IngressRoute: undefined, IngressHost: undefined, + IngressHosts: [], }; } diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index fbd9d3373..152bbc87a 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -1368,7 +1368,7 @@ class="form-control" name="ingress_hostname_{{ $index }}" ng-model="publishedPort.IngressHost" - ng-options="host as (host | kubernetesApplicationIngressEmptyHostname) for host in ctrl.ingressHostnames" + ng-options="host as (host | kubernetesApplicationIngressEmptyHostname) for host in publishedPort.IngressHosts" ng-change="ctrl.onChangePublishedPorts()" ng-disabled="ctrl.disableLoadBalancerEdit() || ctrl.isEditAndNotNewPublishedPort($index)" > diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index dcbc18faa..09b25384f 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -321,6 +321,7 @@ class KubernetesCreateApplicationController { const ingresses = this.filteredIngresses; p.IngressName = ingresses && ingresses.length ? ingresses[0].Name : undefined; p.IngressHost = ingresses && ingresses.length ? ingresses[0].Hosts[0] : undefined; + p.IngressHosts = ingresses && ingresses.length ? ingresses[0].Hosts : undefined; if (this.formValues.PublishedPorts.length) { p.Protocol = this.formValues.PublishedPorts[0].Protocol; } @@ -388,6 +389,7 @@ class KubernetesCreateApplicationController { onChangePortMappingIngress(index) { const publishedPort = this.formValues.PublishedPorts[index]; const ingress = _.find(this.filteredIngresses, { Name: publishedPort.IngressName }); + publishedPort.IngressHosts = ingress.Hosts; this.ingressHostnames = ingress.Hosts; publishedPort.IngressHost = this.ingressHostnames.length ? this.ingressHostnames[0] : []; this.onChangePublishedPorts(); @@ -972,7 +974,8 @@ class KubernetesCreateApplicationController { this.resourcePools, this.configurations, this.persistentVolumeClaims, - this.nodesLabels + this.nodesLabels, + this.filteredIngresses ); this.formValues.OriginalIngresses = this.filteredIngresses; this.savedFormValues = angular.copy(this.formValues);