Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no longer remove the agent ignore label from namespaces #2623

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/pkg/cluster/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ func AdoptZarfManagedLabels(labels map[string]string) map[string]string {
labels = make(map[string]string)
}
labels[k8s.ZarfManagedByLabel] = "zarf"
delete(labels, k8s.AgentLabel)
return labels
}
16 changes: 16 additions & 0 deletions src/test/e2e/26_simple_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,19 @@ func TestManifests(t *testing.T) {
stdOut, stdErr, err = e2e.Zarf("package", "remove", "manifests", "--confirm")
require.NoError(t, err, stdOut, stdErr)
}

func TestAgentIgnore(t *testing.T) {
t.Log("E2E: Test Manifests that are Agent Ignored")
e2e.SetupWithCluster(t)

testCreate := filepath.Join("src", "test", "packages", "26-agent-ignore")
testDeploy := filepath.Join("build", fmt.Sprintf("zarf-package-agent-ignore-namespace-%s.tar.zst", e2e.Arch))

// Create the agent ignore test package
stdOut, stdErr, err := e2e.Zarf("package", "create", testCreate, "-o", "build", "--confirm")
require.NoError(t, err, stdOut, stdErr)

// Deploy the agent ignore test package
stdOut, stdErr, err = e2e.Zarf("package", "deploy", testDeploy, "--confirm")
require.NoError(t, err, stdOut, stdErr)
}
20 changes: 20 additions & 0 deletions src/test/packages/26-agent-ignore/manifests/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deployment
spec:
selector:
matchLabels:
app: httpd
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
# This is explicitly a different tag than examples/manifests to ensure it has to pull the image from outside the cluster
image: "httpd:alpine"
ports:
- containerPort: 80
6 changes: 6 additions & 0 deletions src/test/packages/26-agent-ignore/manifests/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: httpd-ignored
labels:
zarf.dev/agent: ignore
23 changes: 23 additions & 0 deletions src/test/packages/26-agent-ignore/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
kind: ZarfPackageConfig
metadata:
name: agent-ignore-namespace
description: Simple test to check that Zarf respects ignored namespaces.

components:
- name: httpd-deployment
required: true
manifests:
- name: agent-ignore-httpd
namespace: httpd-ignored
files:
- manifests/deployment.yaml
- manifests/namespace.yaml
actions:
onDeploy:
after:
- wait:
cluster:
kind: deployment
name: httpd-deployment
namespace: httpd-ignored
condition: "{.status.readyReplicas}=2"
Loading