diff --git a/app/kubernetes/converters/application.js b/app/kubernetes/converters/application.js index 76dfb1541..71e94329d 100644 --- a/app/kubernetes/converters/application.js +++ b/app/kubernetes/converters/application.js @@ -294,7 +294,13 @@ class KubernetesApplicationConverter { res.DataAccessPolicy = app.DataAccessPolicy; res.EnvironmentVariables = KubernetesApplicationHelper.generateEnvVariablesFromEnv(app.Env); res.PersistedFolders = KubernetesApplicationHelper.generatePersistedFoldersFormValuesFromPersistedFolders(app.PersistedFolders, persistentVolumeClaims); // generate from PVC and app.PersistedFolders - res.Configurations = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(app.Env, app.ConfigurationVolumes, configurations); + res.Secrets = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes(app.Env, app.ConfigurationVolumes, configurations, 'valueFrom.secretKeyRef.name'); + res.ConfigMaps = KubernetesApplicationHelper.generateConfigurationFormValuesFromEnvAndVolumes( + app.Env, + app.ConfigurationVolumes, + configurations, + 'valueFrom.configMapKeyRef.name' + ); res.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(app.AutoScaler, res.ReplicaCount); res.PublishedPorts = KubernetesApplicationHelper.generatePublishedPortsFormValuesFromPublishedPorts(app.ServiceType, app.PublishedPorts, ingresses); res.Containers = app.Containers; diff --git a/app/kubernetes/helpers/application/index.js b/app/kubernetes/helpers/application/index.js index b640db2b4..9642819f7 100644 --- a/app/kubernetes/helpers/application/index.js +++ b/app/kubernetes/helpers/application/index.js @@ -145,10 +145,8 @@ class KubernetesApplicationHelper { /* #endregion */ /* #region CONFIGURATIONS FV <> ENV & VOLUMES */ - static generateConfigurationFormValuesFromEnvAndVolumes(env, volumes, configurations) { + static generateConfigurationFormValuesFromEnvAndVolumes(env, volumes, configurations, filterCondition) { const finalRes = _.flatMap(configurations, (cfg) => { - const filterCondition = cfg.Kind === KubernetesConfigurationKinds.CONFIGMAP ? 'valueFrom.configMapKeyRef.name' : 'valueFrom.secretKeyRef.name'; - const cfgEnv = _.filter(env, [filterCondition, cfg.Name]); const cfgVol = _.filter(volumes, { configurationName: cfg.Name }); if (!cfgEnv.length && !cfgVol.length) { diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index 2c7606b49..07f565f97 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -495,10 +495,10 @@
-
+
-
+
Portainer will automatically expose all the keys of a Secret as environment variables. This behavior can be overridden to filesystem mounts for each key via the override option. diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index 92a220fa8..f13b1bd9b 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -1136,6 +1136,7 @@ class KubernetesCreateApplicationController { try { this.state.actionInProgress = true; + this.formValues.Configurations = [...this.formValues.ConfigMaps, ...this.formValues.Secrets]; await this.KubernetesApplicationService.patch(this.savedFormValues, this.formValues); this.Notifications.success('Success', 'Request to update application successfully submitted'); this.$state.go('kubernetes.applications.application', { name: this.application.Name, namespace: this.application.ResourcePool });