Skip to content

Commit 0a5b122

Browse files
authored
chore: update to argocd-operator '9249b2daeebaaf35723f9712fe9a47c65ca122b6' (#1023)
Signed-off-by: Jonathan West <jonwest@redhat.com>
1 parent 48ac9cb commit 0a5b122

File tree

11 files changed

+531
-74
lines changed

11 files changed

+531
-74
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ build: generate fmt vet ## Build manager binary.
203203

204204
.PHONY: run
205205
run: manifests generate fmt vet ## Run a controller from your host.
206-
CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES=argo-rollouts,test-rom-ns-1,rom-ns-1,openshift-gitops ARGOCD_CLUSTER_CONFIG_NAMESPACES=openshift-gitops REDIS_CONFIG_PATH="build/redis" go run ./cmd/main.go
206+
CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES=argo-rollouts,test-rom-ns-1,rom-ns-1,openshift-gitops ARGOCD_CLUSTER_CONFIG_NAMESPACES="openshift-gitops, argocd-e2e-cluster-config, argocd-test-impersonation-1-046, argocd-agent-principal-1-051, argocd-agent-agent-1-052, appset-argocd, appset-old-ns, appset-new-ns" REDIS_CONFIG_PATH="build/redis" go run ./cmd/main.go
207207

208208
.PHONY: docker-build
209209
docker-build: test ## Build docker image with the manager.

controllers/argocd/openshift/openshift_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ func TestAdminClusterRoleMapper(t *testing.T) {
306306

307307
// Sort both slices to ensure consistent comparison
308308
sort.Slice(result, func(i, j int) bool {
309-
return result[i].NamespacedName.Name < result[j].NamespacedName.Name
309+
return result[i].Name < result[j].Name
310310
})
311311
sort.Slice(expectedRequests, func(i, j int) bool {
312-
return expectedRequests[i].NamespacedName.Name < expectedRequests[j].NamespacedName.Name
312+
return expectedRequests[i].Name < expectedRequests[j].Name
313313
})
314314

315315
assert.Equal(t, expectedRequests, result)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.6
44

55
require (
66
github.com/argoproj-labs/argo-rollouts-manager v0.0.6-0.20250731075119-a100fc1d88b8
7-
github.com/argoproj-labs/argocd-operator v0.0.0-20251125105011-0c039cea85fd
7+
github.com/argoproj-labs/argocd-operator v0.16.0-rc1.0.20251204063443-9249b2daeeba
88
github.com/argoproj/argo-cd/v3 v3.1.5
99
github.com/argoproj/gitops-engine v0.7.1-0.20250905160054-e48120133eec
1010
github.com/go-logr/logr v1.4.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI
3131
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
3232
github.com/argoproj-labs/argo-rollouts-manager v0.0.6-0.20250731075119-a100fc1d88b8 h1:6+eo7BKrNkSIhQ1nnyCUloSNrGzghlb8r8e7GokoeBo=
3333
github.com/argoproj-labs/argo-rollouts-manager v0.0.6-0.20250731075119-a100fc1d88b8/go.mod h1:yTwzKUV79YyI764hkXdVojGYBA9yKJk3qXx5mRuQ2Xc=
34-
github.com/argoproj-labs/argocd-operator v0.0.0-20251125105011-0c039cea85fd h1:67RjGDPc5LI2aWGSnnOtAi9LoMSnuBP0oFm5LLoyQlk=
35-
github.com/argoproj-labs/argocd-operator v0.0.0-20251125105011-0c039cea85fd/go.mod h1:NCFt9E3K/eXfjfuXGQXLe+zKQCeRCaZv7ZsbbXFPpOw=
34+
github.com/argoproj-labs/argocd-operator v0.16.0-rc1.0.20251204063443-9249b2daeeba h1:78B//Rfc/acaf/4JDGDHwPtOuNHRujC+j9UiMBDyO8A=
35+
github.com/argoproj-labs/argocd-operator v0.16.0-rc1.0.20251204063443-9249b2daeeba/go.mod h1:NCFt9E3K/eXfjfuXGQXLe+zKQCeRCaZv7ZsbbXFPpOw=
3636
github.com/argoproj/argo-cd/v3 v3.1.5 h1:dm1SY5CaILDIQIQINA4H6uJrXpExyif2Yz5915g91kQ=
3737
github.com/argoproj/argo-cd/v3 v3.1.5/go.mod h1:ZHb/LOz/hr88VWMJiVTd8DGYL7MheHCAT8S6DgYOBFo=
3838
github.com/argoproj/gitops-engine v0.7.1-0.20250905160054-e48120133eec h1:rNAwbRQFvRIuW/e2bU+B10mlzghYXsnwZedYeA7Drz4=

test/openshift/e2e/ginkgo/fixture/fixture.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,29 @@ func OutputDebugOnFail(namespaceParams ...any) {
862862
GinkgoWriter.Println(kubectlOutput)
863863
GinkgoWriter.Println("----------------------------------------------------------------")
864864

865+
kubectlOutput, err = osFixture.ExecCommandWithOutputParam(false, "kubectl", "get", "deployments", "-n", namespace, "-o", "yaml")
866+
if err != nil {
867+
GinkgoWriter.Println("unable to list", namespace, err, kubectlOutput)
868+
continue
869+
}
870+
871+
GinkgoWriter.Println("")
872+
GinkgoWriter.Println("----------------------------------------------------------------")
873+
GinkgoWriter.Println("'kubectl get deployments -n " + namespace + " -o yaml")
874+
GinkgoWriter.Println(kubectlOutput)
875+
GinkgoWriter.Println("----------------------------------------------------------------")
876+
877+
kubectlOutput, err = osFixture.ExecCommandWithOutputParam(false, "kubectl", "get", "events", "-n", namespace)
878+
if err != nil {
879+
GinkgoWriter.Println("unable to get events for namespace", err, kubectlOutput)
880+
} else {
881+
GinkgoWriter.Println("")
882+
GinkgoWriter.Println("----------------------------------------------------------------")
883+
GinkgoWriter.Println("'kubectl get events -n " + namespace + ":")
884+
GinkgoWriter.Println(kubectlOutput)
885+
GinkgoWriter.Println("----------------------------------------------------------------")
886+
}
887+
865888
}
866889

867890
kubectlOutput, err := osFixture.ExecCommandWithOutputParam(false, "kubectl", "get", "argocds", "-A", "-o", "yaml")
@@ -875,6 +898,8 @@ func OutputDebugOnFail(namespaceParams ...any) {
875898
GinkgoWriter.Println("----------------------------------------------------------------")
876899
}
877900

901+
GinkgoWriter.Println("You can skip this debug output by setting 'SKIP_DEBUG_OUTPUT=true'")
902+
878903
}
879904

880905
func outputPodLog(podSubstring string) {

test/openshift/e2e/ginkgo/fixture/k8s/fixture.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ func NotHaveLabelWithValue(key string, value string) matcher.GomegaMatcher {
9090
return true
9191
}
9292

93+
GinkgoWriter.Println("NotHaveLabelWithValue: not expected: ", key, "/", value, ". actual:", labels[key])
94+
9395
return labels[key] != value
9496

9597
}, BeTrue())

test/openshift/e2e/ginkgo/fixture/secret/fixture.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ func HaveDataKeyValue(key string, value []byte) matcher.GomegaMatcher {
8282

8383
}
8484

85+
// NotHaveDataKey returns true if Secret's .data 'key' does not exist, false otherwise
86+
func NotHaveDataKey(key string) matcher.GomegaMatcher {
87+
return fetchSecret(func(secret *corev1.Secret) bool {
88+
_, exists := secret.Data[key]
89+
GinkgoWriter.Println("NotHaveDataKey - key:", key, "Exists:", exists)
90+
return !exists
91+
})
92+
93+
}
94+
8595
// This is intentionally NOT exported, for now. Create another function in this file/package that calls this function, and export that.
8696
func fetchSecret(f func(*corev1.Secret) bool) matcher.GomegaMatcher {
8797

test/openshift/e2e/ginkgo/sequential/1-036_validate_role_rolebinding_for_source_namespace_test.go

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import (
1212
namespaceFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/namespace"
1313
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils"
1414

15+
corev1 "k8s.io/api/core/v1"
1516
rbacv1 "k8s.io/api/rbac/v1"
17+
apierrors "k8s.io/apimachinery/pkg/api/errors"
1618
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1719
"sigs.k8s.io/controller-runtime/pkg/client"
1820
)
@@ -22,8 +24,10 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
2224
Context("1-036_validate_role_rolebinding_for_source_namespace", func() {
2325

2426
var (
25-
ctx context.Context
26-
k8sClient client.Client
27+
ctx context.Context
28+
k8sClient client.Client
29+
argoNamespace *corev1.Namespace
30+
cleanupArgoNSFunc func()
2731

2832
defaultNSArgoCD *v1beta1.ArgoCD
2933

@@ -39,30 +43,39 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
3943

4044
AfterEach(func() {
4145

42-
fixture.OutputDebugOnFail("default")
46+
fixture.OutputDebugOnFail(argoNamespace)
47+
48+
// Clean up argo cd instance created in test namespace first (before deleting the namespace itself)
49+
Expect(defaultNSArgoCD).ToNot(BeNil())
50+
err := k8sClient.Delete(ctx, defaultNSArgoCD)
51+
if err != nil && !apierrors.IsNotFound(err) {
52+
Expect(err).ToNot(HaveOccurred())
53+
}
4354

4455
// Clean up namespaces created
4556
for _, namespaceCleanupFunction := range cleanupFunctions {
4657
namespaceCleanupFunction()
4758
}
4859

49-
// Clean up argo cd instance created in 'default' NS
50-
Expect(defaultNSArgoCD).ToNot(BeNil())
51-
Expect(k8sClient.Delete(ctx, defaultNSArgoCD)).To(Succeed())
52-
5360
})
5461

5562
It("verifies that ArgoCD CR '.spec.sourceNamespaces' field wildcard-matching matches and manages only namespaces which match the wildcard", func() {
5663

64+
fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", "openshift-gitops, argocd-e2e-cluster-config")
65+
66+
By("creating cluster-scoped namespace for Argo CD instance")
67+
argoNamespace, cleanupArgoNSFunc = fixture.CreateNamespaceWithCleanupFunc("argocd-e2e-cluster-config")
68+
cleanupFunctions = append(cleanupFunctions, cleanupArgoNSFunc)
69+
5770
By("creating test NS")
5871
testNS, cleanupFunc := fixture.CreateNamespaceWithCleanupFunc("test")
5972
cleanupFunctions = append(cleanupFunctions, cleanupFunc)
6073

61-
By("creating Argo CD instance in default NS, with 'test' sourceNamespace only")
74+
By("creating Argo CD instance in argocd-e2e-cluster-config NS, with 'test' sourceNamespace only")
6275
defaultNSArgoCD = &v1beta1.ArgoCD{
6376
ObjectMeta: metav1.ObjectMeta{
6477
Name: "example-argocd",
65-
Namespace: "default",
78+
Namespace: argoNamespace.Name,
6679
},
6780
Spec: v1beta1.ArgoCDSpec{
6881
SourceNamespaces: []string{
@@ -73,7 +86,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
7386
Expect(k8sClient.Create(ctx, defaultNSArgoCD)).To(Succeed())
7487

7588
By("verifying Argo CD instance starts managing the namespace via managed-by-cluster-argocd label")
76-
Eventually(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
89+
Eventually(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
7790

7891
expectRoleAndRoleBindingValues := func(name string, ns string) {
7992

@@ -107,12 +120,12 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
107120
{
108121
Kind: "ServiceAccount",
109122
Name: "example-argocd-argocd-server",
110-
Namespace: "default",
123+
Namespace: argoNamespace.Name,
111124
},
112125
{
113126
Kind: "ServiceAccount",
114127
Name: "example-argocd-argocd-application-controller",
115-
Namespace: "default",
128+
Namespace: argoNamespace.Name,
116129
},
117130
}))
118131

@@ -133,7 +146,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
133146
})
134147

135148
By("verifying test-1 NS becomes managed, and expected role/rolebindings exist in test* namespaces but not dev")
136-
Eventually(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
149+
Eventually(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
137150

138151
expectRoleAndRoleBindingValues("example-argocd_test", "test")
139152

@@ -161,7 +174,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
161174
cleanupFunctions = append(cleanupFunctions, cleanupFunc)
162175

163176
By("verifying the test-2 namespace becomes managed by the argo cd instance, and has the expected role/rolebinding")
164-
Eventually(test2NS, "2m", "5s").Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
177+
Eventually(test2NS, "2m", "5s").Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
165178

166179
expectRoleAndRoleBindingValues("example-argocd_test-2", "test-2")
167180

@@ -173,17 +186,17 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
173186
})
174187

175188
By("verifying test, test-1, test-2, and dev are all managed and have the expected roles")
176-
Eventually(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
177-
Consistently(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
189+
Eventually(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
190+
Consistently(testNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
178191

179-
Eventually(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
180-
Consistently(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
192+
Eventually(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
193+
Consistently(test1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
181194

182-
Eventually(test2NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
183-
Consistently(test2NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
195+
Eventually(test2NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
196+
Consistently(test2NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
184197

185-
Eventually(devNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
186-
Consistently(devNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
198+
Eventually(devNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
199+
Consistently(devNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
187200

188201
expectRoleAndRoleBindingValues("example-argocd_test", "test")
189202
expectRoleAndRoleBindingValues("example-argocd_test-1", "test-1")
@@ -208,11 +221,11 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
208221
cleanupFunctions = append(cleanupFunctions, cleanupFunc)
209222

210223
By("verifying test-ns-1 and dev-ns-1 are managed, but other-ns isn't")
211-
Eventually(test_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
212-
Consistently(test_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
224+
Eventually(test_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
225+
Consistently(test_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
213226

214-
Eventually(dev_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
215-
Consistently(dev_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
227+
Eventually(dev_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
228+
Consistently(dev_ns_1NS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
216229

217230
expectRoleAndRoleBindingValues("example-argocd_test-ns-1", "test-ns-1")
218231
expectRoleAndRoleBindingValues("example-argocd_dev-ns-1", "dev-ns-1")
@@ -239,18 +252,18 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
239252
})
240253

241254
By("verifying dev-ns-1 eventually becomes unmanaged")
242-
Eventually(dev_ns_1NS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
243-
Consistently(dev_ns_1NS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "default"))
255+
Eventually(dev_ns_1NS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
256+
Consistently(dev_ns_1NS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argoNamespace.Name))
244257

245258
devns1Role := &rbacv1.Role{
246259
ObjectMeta: metav1.ObjectMeta{
247-
Name: " example-argocd_dev-ns-1",
260+
Name: "example-argocd_dev-ns-1",
248261
Namespace: dev_ns_1NS.Name,
249262
},
250263
}
251264
devns1RoleBinding := &rbacv1.RoleBinding{
252265
ObjectMeta: metav1.ObjectMeta{
253-
Name: " example-argocd_dev-ns-1",
266+
Name: "example-argocd_dev-ns-1",
254267
Namespace: dev_ns_1NS.Name,
255268
},
256269
}

0 commit comments

Comments
 (0)