fix(k8s): fixed apply a note to k8s application (#5586)

pull/5594/head
fhanportainer 3 years ago committed by GitHub
parent 8d8f21368d
commit 1543ad4c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,10 +54,15 @@ class KubernetesDeploymentConverter {
payload.spec.template.metadata.labels.app = deployment.Name; payload.spec.template.metadata.labels.app = deployment.Name;
payload.spec.template.metadata.labels[KubernetesPortainerApplicationNameLabel] = deployment.ApplicationName; payload.spec.template.metadata.labels[KubernetesPortainerApplicationNameLabel] = deployment.ApplicationName;
payload.spec.template.spec.containers[0].name = deployment.Name; payload.spec.template.spec.containers[0].name = deployment.Name;
payload.spec.template.spec.containers[0].image = buildImageFullURI(deployment.ImageModel);
if (deployment.ImageModel.Registry && deployment.ImageModel.Registry.Authentication) { if (deployment.ImageModel) {
payload.spec.template.spec.imagePullSecrets = [{ name: `registry-${deployment.ImageModel.Registry.Id}` }]; payload.spec.template.spec.containers[0].image = buildImageFullURI(deployment.ImageModel);
if (deployment.ImageModel.Registry && deployment.ImageModel.Registry.Authentication) {
payload.spec.template.spec.imagePullSecrets = [{ name: `registry-${deployment.ImageModel.Registry.Id}` }];
}
} }
payload.spec.template.spec.affinity = deployment.Affinity; payload.spec.template.spec.affinity = deployment.Affinity;
KubernetesCommonHelper.assignOrDeleteIfEmpty(payload, 'spec.template.spec.containers[0].env', deployment.Env); KubernetesCommonHelper.assignOrDeleteIfEmpty(payload, 'spec.template.spec.containers[0].env', deployment.Env);
KubernetesCommonHelper.assignOrDeleteIfEmpty(payload, 'spec.template.spec.containers[0].volumeMounts', deployment.VolumeMounts); KubernetesCommonHelper.assignOrDeleteIfEmpty(payload, 'spec.template.spec.containers[0].volumeMounts', deployment.VolumeMounts);

Loading…
Cancel
Save