Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Filter namespace by Zarf label rather than secret and remove 404 err …
Browse files Browse the repository at this point in the history
…check
  • Loading branch information
Lucas Rodriguez committed Dec 12, 2023
1 parent 0910130 commit 4424308
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
14 changes: 5 additions & 9 deletions capabilities/lib/zarf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ export async function updateZarfManagedImageSecrets(
authToken: string,
): Promise<void> {
try {
const namespace = await K8s(kind.Namespace).Get();
const namespace = await K8s(kind.Namespace)
.WithLabel(managedByLabel, "zarf")
.Get();

const namespaces = namespace.items;

for (const ns of namespaces) {
try {
await K8s(kind.Secret)
.InNamespace(ns.metadata!.name!)
.WithLabel(managedByLabel, "zarf")
.Get(zarfImagePullSecret);
} catch (err) {
// Continue checking the next namespace if this namespace doesn't have a "private-registry" secret
if (JSON.stringify(err).includes("404")) {
continue;
}
throw new Error(JSON.stringify(err));
}
// Update the secret with the new ECR auth token
Expand Down Expand Up @@ -74,8 +72,6 @@ export async function updateZarfManagedImageSecrets(
);
}
} catch (err) {
throw new Error(
`unable to update Zarf image pull secrets: ${JSON.stringify(err)}`,
);
throw new Error(`unable to update Zarf image pull secrets: ${err}`);
}
}
18 changes: 9 additions & 9 deletions manifests/pepr-module-b95dbd80-e078-5eb9-aaf3-bcb9567417d0.yaml

Large diffs are not rendered by default.

0 comments on commit 4424308

Please sign in to comment.