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

Commit

Permalink
Remove k8s helper functions/shims
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Dec 8, 2023
1 parent f0d2c6d commit 7a05b5c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 31 deletions.
3 changes: 1 addition & 2 deletions capabilities/ecr-webhook/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
DeployedComponent,
DeployedPackage,
} from "../../zarf-types";
import { getSecret } from "../../lib/k8s";

/**
* Represents a component check result, indicating whether a component is ready for a webhook to execute.
Expand Down Expand Up @@ -188,7 +187,7 @@ export async function updateWebhookStatus(

try {
// Fetch the package secret
const secret = await getSecret(ns, secretName);
const secret = await K8s(kind.Secret).InNamespace(ns).Get(secretName);

if (secret.data === undefined) {
throw new Error(
Expand Down
13 changes: 0 additions & 13 deletions capabilities/lib/k8s.ts

This file was deleted.

15 changes: 8 additions & 7 deletions capabilities/lib/zarf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getSecret, listNamespaces } from "./k8s";
import { ZarfState } from "../zarf-types";
import { K8s, kind, Log } from "pepr";

Expand All @@ -10,7 +9,9 @@ const zarfManagedByLabel = "app.kubernetes.io/managed-by";

export async function getZarfRegistryURL(): Promise<string> {
try {
const secret = await getSecret(zarfNamespace, zarfStateSecret);
const secret = await K8s(kind.Secret)
.InNamespace(zarfNamespace)
.Get(zarfStateSecret);
const secretString = atob(secret.data!.state);
const zarfState: ZarfState = JSON.parse(secretString);
return zarfState.registryInfo.address;
Expand All @@ -30,14 +31,14 @@ export async function updateZarfManagedImageSecrets(
let registrySecret: kind.Secret | undefined;

try {
const namespaces = await listNamespaces();
const namespace = await K8s(kind.Namespace).Get();
const namespaces = namespace.items;

for (const ns of namespaces) {
try {
registrySecret = await getSecret(
ns.metadata!.name!,
zarfImagePullSecret,
);
registrySecret = await K8s(kind.Secret)
.InNamespace(ns.metadata!.name!)
.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")) {
Expand Down
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 7a05b5c

Please sign in to comment.