mirror of https://github.com/portainer/portainer
fix(k8s/configurations): fix an issue with configuration ownership
parent
7ad06b3be5
commit
46762f3e67
|
@ -52,6 +52,7 @@ class KubernetesConfigMapConverter {
|
||||||
res.metadata.uid = data.Id;
|
res.metadata.uid = data.Id;
|
||||||
res.metadata.name = data.Name;
|
res.metadata.name = data.Name;
|
||||||
res.metadata.namespace = data.Namespace;
|
res.metadata.namespace = data.Namespace;
|
||||||
|
res.metadata.labels[KubernetesPortainerConfigurationOwnerLabel] = data.ConfigurationOwner;
|
||||||
res.data = data.Data;
|
res.data = data.Data;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,21 +87,24 @@ class KubernetesConfigurationService {
|
||||||
/**
|
/**
|
||||||
* UPDATE
|
* UPDATE
|
||||||
*/
|
*/
|
||||||
async updateAsync(formValues) {
|
async updateAsync(formValues, configuration) {
|
||||||
try {
|
try {
|
||||||
if (formValues.Type === KubernetesConfigurationTypes.CONFIGMAP) {
|
if (formValues.Type === KubernetesConfigurationTypes.CONFIGMAP) {
|
||||||
const configMap = KubernetesConfigMapConverter.configurationFormValuesToConfigMap(formValues);
|
const configMap = KubernetesConfigMapConverter.configurationFormValuesToConfigMap(formValues);
|
||||||
|
configMap.ConfigurationOwner = configuration.ConfigurationOwner;
|
||||||
await this.KubernetesConfigMapService.update(configMap);
|
await this.KubernetesConfigMapService.update(configMap);
|
||||||
} else {
|
} else {
|
||||||
const secret = KubernetesSecretConverter.configurationFormValuesToSecret(formValues);
|
const secret = KubernetesSecretConverter.configurationFormValuesToSecret(formValues);
|
||||||
|
secret.ConfigurationOwner = configuration.ConfigurationOwner;
|
||||||
await this.KubernetesSecretService.update(secret);
|
await this.KubernetesSecretService.update(secret);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update(config) {
|
|
||||||
return this.$async(this.updateAsync, config);
|
update(formValues, configuration) {
|
||||||
|
return this.$async(this.updateAsync, formValues, configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -94,7 +94,7 @@ class KubernetesConfigurationController {
|
||||||
{ reload: true }
|
{ reload: true }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await this.KubernetesConfigurationService.update(this.formValues);
|
await this.KubernetesConfigurationService.update(this.formValues, this.configuration);
|
||||||
this.Notifications.success('Configuration succesfully updated');
|
this.Notifications.success('Configuration succesfully updated');
|
||||||
this.$state.reload();
|
this.$state.reload();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue