From 1b38857bb4cdf9153f85cccad6dcddbbf0c08392 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Wed, 5 Oct 2022 15:44:26 -0500 Subject: [PATCH 1/4] Fix agent mutation of new registry --- src/internal/agent/hooks/pods.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal/agent/hooks/pods.go b/src/internal/agent/hooks/pods.go index 628af5ec5c..867b988dce 100644 --- a/src/internal/agent/hooks/pods.go +++ b/src/internal/agent/hooks/pods.go @@ -43,8 +43,8 @@ func mutatePod(r *v1.AdmissionRequest) (*operations.Result, error) { return &operations.Result{Msg: err.Error()}, nil } - if pod.Labels != nil && pod.Labels["zarf-agent"] == "patched" { - // We've already played with this pod, just keep swimming 🐟 + if pod.Labels != nil && (pod.Labels["zarf-agent"] == "patched" || pod.Labels["release"] == "zarf-docker-registry") { + // We've already played with this pod, or it is the internal registry itself, just keep swimming 🐟 return &operations.Result{ Allowed: true, PatchOps: patchOperations, From 3b92a84654f856880e73a6072b78a88365b8edd5 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Wed, 5 Oct 2022 15:53:45 -0500 Subject: [PATCH 2/4] Update zarf agent image reference --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3186a38d25..88d10c6a20 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ ifneq ($(UNAME_S),Linux) endif endif -AGENT_IMAGE ?= zarfdev/agent:ef08e77c3880ac64c3cc10ecd314be0869f8f70e +AGENT_IMAGE ?= zarfdev/agent:9cb1e8a7699379543d9855a606a8e9820f0d776b CLI_VERSION := $(if $(shell git describe --tags),$(shell git describe --tags),"UnknownVersion") BUILD_ARGS := -s -w -X 'github.com/defenseunicorns/zarf/src/config.CLIVersion=$(CLI_VERSION)' From f8fd4b4a56b7cb0bca88db7a2e2347f331d0e57f Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Thu, 6 Oct 2022 10:18:19 -0500 Subject: [PATCH 3/4] Flip the logic around a bit to not modify the agent --- Makefile | 2 +- packages/zarf-registry/registry-values.yaml | 3 +++ src/internal/agent/hooks/pods.go | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88d10c6a20..3186a38d25 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ ifneq ($(UNAME_S),Linux) endif endif -AGENT_IMAGE ?= zarfdev/agent:9cb1e8a7699379543d9855a606a8e9820f0d776b +AGENT_IMAGE ?= zarfdev/agent:ef08e77c3880ac64c3cc10ecd314be0869f8f70e CLI_VERSION := $(if $(shell git describe --tags),$(shell git describe --tags),"UnknownVersion") BUILD_ARGS := -s -w -X 'github.com/defenseunicorns/zarf/src/config.CLIVersion=$(CLI_VERSION)' diff --git a/packages/zarf-registry/registry-values.yaml b/packages/zarf-registry/registry-values.yaml index ab620289e9..75bd52cbe0 100644 --- a/packages/zarf-registry/registry-values.yaml +++ b/packages/zarf-registry/registry-values.yaml @@ -27,3 +27,6 @@ resources: memory: "2Gi" fullnameOverride: "zarf-docker-registry" + +podLabels: + zarf-agent: "patched" diff --git a/src/internal/agent/hooks/pods.go b/src/internal/agent/hooks/pods.go index 867b988dce..628af5ec5c 100644 --- a/src/internal/agent/hooks/pods.go +++ b/src/internal/agent/hooks/pods.go @@ -43,8 +43,8 @@ func mutatePod(r *v1.AdmissionRequest) (*operations.Result, error) { return &operations.Result{Msg: err.Error()}, nil } - if pod.Labels != nil && (pod.Labels["zarf-agent"] == "patched" || pod.Labels["release"] == "zarf-docker-registry") { - // We've already played with this pod, or it is the internal registry itself, just keep swimming 🐟 + if pod.Labels != nil && pod.Labels["zarf-agent"] == "patched" { + // We've already played with this pod, just keep swimming 🐟 return &operations.Result{ Allowed: true, PatchOps: patchOperations, From 690546cf75c36baa66164860d80d6fcd0b6b6200 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Thu, 6 Oct 2022 23:00:22 -0500 Subject: [PATCH 4/4] Change pod label to ignore instead of patched --- packages/zarf-registry/registry-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zarf-registry/registry-values.yaml b/packages/zarf-registry/registry-values.yaml index 75bd52cbe0..72a5d9e452 100644 --- a/packages/zarf-registry/registry-values.yaml +++ b/packages/zarf-registry/registry-values.yaml @@ -29,4 +29,4 @@ resources: fullnameOverride: "zarf-docker-registry" podLabels: - zarf-agent: "patched" + zarf.dev/agent: "ignore"