Skip to content

Commit b00bc78

Browse files
downstream rollouts-manager imagepullpolicy feature (#998)
Signed-off-by: Alka Kumari <[email protected]>
1 parent 993a736 commit b00bc78

File tree

6 files changed

+197
-4
lines changed

6 files changed

+197
-4
lines changed

bundle/manifests/argoproj.io_rolloutmanagers.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ spec:
250250
image:
251251
description: Image defines Argo Rollouts controller image (optional)
252252
type: string
253+
imagePullPolicy:
254+
description: |-
255+
ImagePullPolicy specifies the image pull policy for the Rollouts controller.
256+
Valid values are: Always, IfNotPresent, Never
257+
enum:
258+
- Always
259+
- IfNotPresent
260+
- Never
261+
type: string
253262
namespaceScoped:
254263
description: NamespaceScoped lets you specify if RolloutManager has
255264
to watch a namespace or the whole cluster

bundle/manifests/gitops-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ metadata:
180180
capabilities: Deep Insights
181181
console.openshift.io/plugins: '["gitops-plugin"]'
182182
containerImage: quay.io/redhat-developer/gitops-operator
183-
createdAt: "2025-11-04T06:20:36Z"
183+
createdAt: "2025-11-05T07:51:38Z"
184184
description: Enables teams to adopt GitOps principles for managing cluster configurations
185185
and application delivery across hybrid multi-cluster Kubernetes environments.
186186
features.operators.openshift.io/disconnected: "true"

config/crd/bases/argoproj.io_rolloutmanagers.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ spec:
250250
image:
251251
description: Image defines Argo Rollouts controller image (optional)
252252
type: string
253+
imagePullPolicy:
254+
description: |-
255+
ImagePullPolicy specifies the image pull policy for the Rollouts controller.
256+
Valid values are: Always, IfNotPresent, Never
257+
enum:
258+
- Always
259+
- IfNotPresent
260+
- Never
261+
type: string
253262
namespaceScoped:
254263
description: NamespaceScoped lets you specify if RolloutManager has
255264
to watch a namespace or the whole cluster

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/redhat-developer/gitops-operator
33
go 1.24.6
44

55
require (
6-
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941
6+
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449
77
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a
88
github.com/argoproj/argo-cd/v3 v3.1.8
99
github.com/argoproj/gitops-engine v0.7.1-0.20250905160054-e48120133eec

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21j
2929
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
3030
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
3131
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
32-
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941 h1:uqkUVemiOX050ktlgbyYs4jef38HRU17C9sTzHTL9JU=
33-
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941/go.mod h1:WPyZkNHZjir/OTt8mrRwcUZKe1euHrHPJsRv1Wp/F/0=
32+
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449 h1:EAU1bnt7xADjcTwjAbov5l7TsCWKTDBV59U1dCXKsU8=
33+
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449/go.mod h1:WPyZkNHZjir/OTt8mrRwcUZKe1euHrHPJsRv1Wp/F/0=
3434
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a h1:MruEtChFnhTI8Owa1Boqo7BChWxnVRkyhN1/dsg/VgQ=
3535
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a/go.mod h1:ABtgKWsvMlUp6Xys8BVi0CHKdT9ZoFP+rYCqRsY0wvg=
3636
github.com/argoproj/argo-cd/v3 v3.1.8 h1:NkLPiRI5qGkV+q1EN3O7/0Wb9O/MVl62vadKteZqMUw=
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package sequential
18+
19+
import (
20+
"context"
21+
22+
rolloutmanagerv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1"
23+
. "github.com/onsi/ginkgo/v2"
24+
. "github.com/onsi/gomega"
25+
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture"
26+
deploymentFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/deployment"
27+
k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s"
28+
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils"
29+
appsv1 "k8s.io/api/apps/v1"
30+
corev1 "k8s.io/api/core/v1"
31+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32+
"sigs.k8s.io/controller-runtime/pkg/client"
33+
)
34+
35+
var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
36+
37+
Context("1-103_validate_rollouts_imagepullpolicy", func() {
38+
39+
var (
40+
ctx context.Context
41+
k8sClient client.Client
42+
)
43+
44+
BeforeEach(func() {
45+
46+
fixture.EnsureSequentialCleanSlate()
47+
k8sClient, _ = utils.GetE2ETestKubeClient()
48+
ctx = context.Background()
49+
})
50+
51+
It("creates a cluster-scopes Argo Rollouts instance and verifies the default image pull policy", func() {
52+
53+
By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace")
54+
55+
rm := &rolloutmanagerv1alpha1.RolloutManager{
56+
ObjectMeta: metav1.ObjectMeta{
57+
Name: "example-rollout-manager",
58+
Namespace: "openshift-gitops",
59+
},
60+
}
61+
Expect(k8sClient.Create(ctx, rm)).To(Succeed())
62+
63+
By("verifying deplyment exists")
64+
deplName := "argo-rollouts"
65+
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
66+
Eventually(depl).Should(k8sFixture.ExistByName())
67+
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))
68+
69+
By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)")
70+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
71+
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)
72+
73+
})
74+
75+
It("creates a cluster-scopes Argo Rollouts instance and verifies the CR value imagePullPolicy is applied", func() {
76+
77+
By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace with imagePullPolicy set to Always")
78+
79+
rm := &rolloutmanagerv1alpha1.RolloutManager{
80+
ObjectMeta: metav1.ObjectMeta{
81+
Name: "example-rollout-manager",
82+
Namespace: "openshift-gitops",
83+
},
84+
Spec: rolloutmanagerv1alpha1.RolloutManagerSpec{
85+
ImagePullPolicy: corev1.PullAlways,
86+
},
87+
}
88+
Expect(k8sClient.Create(ctx, rm)).To(Succeed())
89+
90+
By("verifying deplyment exists")
91+
deplName := "argo-rollouts"
92+
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
93+
Eventually(depl).Should(k8sFixture.ExistByName())
94+
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))
95+
96+
By("verifying deployment has ImagePullPolicy set to the CR value(Always)")
97+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
98+
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)
99+
100+
By("updating the RolloutManager CR to set imagePullPolicy to Never")
101+
patch := client.MergeFrom(rm.DeepCopy())
102+
rm.Spec.ImagePullPolicy = corev1.PullNever
103+
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())
104+
105+
By("verifying deployment has ImagePullPolicy set to the CR value(Never)")
106+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever, depl), "3m", "5s").Should(BeTrue(),
107+
"Deployment %s should have all containers with ImagePullPolicy set to Never", deplName)
108+
109+
By("Removing the imagePullPolicy from the CR and check if the deployment has the imagePullPolicy set to default(IfNotPresent)")
110+
rm.Spec.ImagePullPolicy = ""
111+
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())
112+
113+
By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)")
114+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
115+
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)
116+
})
117+
118+
It("creates a cluster-scopes Argo Rollouts instance and verifies subscription image pull policy is applied", func() {
119+
if fixture.EnvLocalRun() {
120+
Skip("This test does not support local run, as when the controller is running locally there is no env var to modify")
121+
return
122+
}
123+
124+
By("setting the IMAGE_PULL_POLICY environment variable to Always")
125+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Always")
126+
defer func() {
127+
By("removing IMAGE_PULL_POLICY environment variable to restore default behavior")
128+
fixture.RestoreSubcriptionToDefault()
129+
}()
130+
131+
By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace")
132+
rm := &rolloutmanagerv1alpha1.RolloutManager{
133+
ObjectMeta: metav1.ObjectMeta{
134+
Name: "example-rollout-manager",
135+
Namespace: "openshift-gitops",
136+
},
137+
}
138+
Expect(k8sClient.Create(ctx, rm)).To(Succeed())
139+
140+
By("verifying deplyment exists")
141+
deplName := "argo-rollouts"
142+
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
143+
Eventually(depl).Should(k8sFixture.ExistByName())
144+
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))
145+
146+
By("verifying deployment has ImagePullPolicy set to Always")
147+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
148+
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)
149+
150+
By("changing the subscription image pull policy to Never")
151+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Never")
152+
153+
By("verifying deployment has ImagePullPolicy set to Never")
154+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever, depl), "3m", "5s").Should(BeTrue(),
155+
"Deployment %s should have all containers with ImagePullPolicy set to Never", deplName)
156+
157+
By("changing the subscription image pull policy to IfNotPresent")
158+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "IfNotPresent")
159+
160+
By("verifying deployment has ImagePullPolicy set to IfNotPresent")
161+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
162+
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)
163+
164+
By("setting imagePullPolicy in CR and verify if the deployment has the imagePullPolicy set to the CR value")
165+
patch := client.MergeFrom(rm.DeepCopy())
166+
rm.Spec.ImagePullPolicy = corev1.PullAlways
167+
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())
168+
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
169+
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)
170+
171+
})
172+
173+
})
174+
175+
})

0 commit comments

Comments
 (0)