Skip to content

Commit

Permalink
fix: filter source ns
Browse files Browse the repository at this point in the history
  • Loading branch information
srodenhuis committed Aug 16, 2023
1 parent a7e918e commit 3ba0fa7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/tasks/otomi/copy-certs-argo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const targetNamespace = 'argocd'

const processed: string[] = []

export const targetPullSecretsFilter = ({ metadata }: V1Secret): boolean =>
metadata!.name!.indexOf(`copy-`) === 0 && metadata!.name === 'harbor-pullsecret'
export const targetPullSecretsFilter = ({ metadata }: V1Secret): boolean => metadata!.name!.indexOf(`copy-`) === 0

// Returns list of names of all pull secrets in the target namespace that were created before.
export const getTargetPullSecretNames = async (): Promise<string[]> => {
Expand Down Expand Up @@ -53,12 +52,19 @@ export const copyTeamPullSecrets = async (teamId: string, targetPullSecretNames:
console.info(`Copying Pull secrets from team-${teamId} to ${targetNamespace} namespace`)
const namespace = `team-${teamId}`
const getTargetSecretName = (name) => `copy-team-${teamId}-${name}`
// get all target namespace Pull secrets
// get all team namespace Pull secrets
const {
body: { items: teamPullSecrets },
} = await k8s
.core()
.listNamespacedSecret(namespace, undefined, undefined, undefined, 'type=kubernetes.io/dockerconfigjson')
.listNamespacedSecret(
namespace,
undefined,
undefined,
undefined,
'type=kubernetes.io/dockerconfigjson',
'metadata.name=harbor-pullsecret',
)
// create new ones if not existing
await Promise.all(
teamPullSecrets
Expand Down

0 comments on commit 3ba0fa7

Please sign in to comment.