Skip to content

Commit

Permalink
fix: remove ignore label when adopting resource (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba authored Jul 8, 2024
1 parent 014d1d2 commit 7288cf2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pkg/cluster/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ func AdoptZarfManagedLabels(labels map[string]string) map[string]string {
labels = make(map[string]string)
}
labels[ZarfManagedByLabel] = "zarf"
delete(labels, AgentLabel)
return labels
}
25 changes: 25 additions & 0 deletions src/pkg/cluster/namespace_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors

package cluster

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestAdoptZarfManagedLabels(t *testing.T) {
t.Parallel()

labels := map[string]string{
"foo": "bar",
AgentLabel: "ignore",
}
adoptedLabels := AdoptZarfManagedLabels(labels)
expectedLabels := map[string]string{
"foo": "bar",
ZarfManagedByLabel: "zarf",
}
require.Equal(t, expectedLabels, adoptedLabels)
}

0 comments on commit 7288cf2

Please sign in to comment.