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.name = data.Name;
|
||||
res.metadata.namespace = data.Namespace;
|
||||
res.metadata.labels[KubernetesPortainerConfigurationOwnerLabel] = data.ConfigurationOwner;
|
||||
res.data = data.Data;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -87,21 +87,24 @@ class KubernetesConfigurationService {
|
|||
/**
|
||||
* UPDATE
|
||||
*/
|
||||
async updateAsync(formValues) {
|
||||
async updateAsync(formValues, configuration) {
|
||||
try {
|
||||
if (formValues.Type === KubernetesConfigurationTypes.CONFIGMAP) {
|
||||
const configMap = KubernetesConfigMapConverter.configurationFormValuesToConfigMap(formValues);
|
||||
configMap.ConfigurationOwner = configuration.ConfigurationOwner;
|
||||
await this.KubernetesConfigMapService.update(configMap);
|
||||
} else {
|
||||
const secret = KubernetesSecretConverter.configurationFormValuesToSecret(formValues);
|
||||
secret.ConfigurationOwner = configuration.ConfigurationOwner;
|
||||
await this.KubernetesSecretService.update(secret);
|
||||
}
|
||||
} catch (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 }
|
||||
);
|
||||
} else {
|
||||
await this.KubernetesConfigurationService.update(this.formValues);
|
||||
await this.KubernetesConfigurationService.update(this.formValues, this.configuration);
|
||||
this.Notifications.success('Configuration succesfully updated');
|
||||
this.$state.reload();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue