From 10858ddb339a765669c7e521af6c32f9826ecc8b Mon Sep 17 00:00:00 2001 From: Lokananda Prabhu Date: Fri, 22 Nov 2024 15:06:45 +0530 Subject: [PATCH] Handled duplicate image pull secrets issue in D & DC edit form --- .../src/components/deployments/utils/deployment-utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/packages/dev-console/src/components/deployments/utils/deployment-utils.ts b/frontend/packages/dev-console/src/components/deployments/utils/deployment-utils.ts index 591baf694a1..21f2028b5c6 100644 --- a/frontend/packages/dev-console/src/components/deployments/utils/deployment-utils.ts +++ b/frontend/packages/dev-console/src/components/deployments/utils/deployment-utils.ts @@ -595,7 +595,12 @@ export const convertEditFormToDeployment = ( containers: getUpdatedContainers(containers, fromImageStreamTag, isi, imageName, envs), imagePullSecrets: [ ...(deployment.spec.template.spec.imagePullSecrets ?? []), - ...(imagePullSecret ? [{ name: imagePullSecret }] : []), + ...(imagePullSecret && + !(deployment.spec.template.spec.imagePullSecrets ?? []).some( + (secret) => secret.name === imagePullSecret, + ) + ? [{ name: imagePullSecret }] + : []), ], }, },