mirror of https://github.com/portainer/portainer
fix(app): fix app env var update issues [EE-5078] (#9066)
Co-authored-by: testa113 <testa113>pull/9067/head
parent
424c98e256
commit
3721c1478e
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -495,10 +495,10 @@
|
|||
|
||||
<!-- #region SECRETS -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 vertical-center">
|
||||
<div class="col-sm-12 vertical-center pt-2.5">
|
||||
<label class="control-label !pt-0 text-left">Secret</label>
|
||||
</div>
|
||||
<div class="col-sm-12 small text-muted vertical-center" style="margin-top: 15px" ng-if="ctrl.formValues.Configurations.length">
|
||||
<div class="col-sm-12 small text-muted vertical-center" style="margin-top: 15px" ng-if="ctrl.formValues.Secrets.length">
|
||||
<pr-icon icon="'info'" mode="'primary'"></pr-icon>
|
||||
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.
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Reference in New Issue