Skip to content
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
9 changes: 9 additions & 0 deletions bundle/manifests/argoproj.io_rolloutmanagers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ spec:
image:
description: Image defines Argo Rollouts controller image (optional)
type: string
imagePullPolicy:
description: |-
ImagePullPolicy specifies the image pull policy for the Rollouts controller.
Valid values are: Always, IfNotPresent, Never
enum:
- Always
- IfNotPresent
- Never
type: string
namespaceScoped:
description: NamespaceScoped lets you specify if RolloutManager has
to watch a namespace or the whole cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ metadata:
capabilities: Deep Insights
console.openshift.io/plugins: '["gitops-plugin"]'
containerImage: quay.io/redhat-developer/gitops-operator
createdAt: "2025-11-04T06:20:36Z"
createdAt: "2025-11-05T07:51:38Z"
description: Enables teams to adopt GitOps principles for managing cluster configurations
and application delivery across hybrid multi-cluster Kubernetes environments.
features.operators.openshift.io/disconnected: "true"
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/argoproj.io_rolloutmanagers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ spec:
image:
description: Image defines Argo Rollouts controller image (optional)
type: string
imagePullPolicy:
description: |-
ImagePullPolicy specifies the image pull policy for the Rollouts controller.
Valid values are: Always, IfNotPresent, Never
enum:
- Always
- IfNotPresent
- Never
type: string
namespaceScoped:
description: NamespaceScoped lets you specify if RolloutManager has
to watch a namespace or the whole cluster
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/redhat-developer/gitops-operator
go 1.24.6

require (
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a
github.com/argoproj/argo-cd/v3 v3.1.8
github.com/argoproj/gitops-engine v0.7.1-0.20250905160054-e48120133eec
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21j
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941 h1:uqkUVemiOX050ktlgbyYs4jef38HRU17C9sTzHTL9JU=
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251029155400-4619e3168941/go.mod h1:WPyZkNHZjir/OTt8mrRwcUZKe1euHrHPJsRv1Wp/F/0=
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449 h1:EAU1bnt7xADjcTwjAbov5l7TsCWKTDBV59U1dCXKsU8=
github.com/argoproj-labs/argo-rollouts-manager v0.0.7-0.20251104202229-c016d0810449/go.mod h1:WPyZkNHZjir/OTt8mrRwcUZKe1euHrHPJsRv1Wp/F/0=
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a h1:MruEtChFnhTI8Owa1Boqo7BChWxnVRkyhN1/dsg/VgQ=
github.com/argoproj-labs/argocd-operator v0.14.0-rc1.0.20251104052658-38b9581ce39a/go.mod h1:ABtgKWsvMlUp6Xys8BVi0CHKdT9ZoFP+rYCqRsY0wvg=
github.com/argoproj/argo-cd/v3 v3.1.8 h1:NkLPiRI5qGkV+q1EN3O7/0Wb9O/MVl62vadKteZqMUw=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
Copyright 2025.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package sequential

import (
"context"

rolloutmanagerv1alpha1 "github.com/argoproj-labs/argo-rollouts-manager/api/v1alpha1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture"
deploymentFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/deployment"
k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s"
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

var _ = Describe("GitOps Operator Sequential E2E Tests", func() {

Context("1-103_validate_rollouts_imagepullpolicy", func() {

var (
ctx context.Context
k8sClient client.Client
)

BeforeEach(func() {

fixture.EnsureSequentialCleanSlate()
k8sClient, _ = utils.GetE2ETestKubeClient()
ctx = context.Background()
})

It("creates a cluster-scopes Argo Rollouts instance and verifies the default image pull policy", func() {

By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace")

rm := &rolloutmanagerv1alpha1.RolloutManager{
ObjectMeta: metav1.ObjectMeta{
Name: "example-rollout-manager",
Namespace: "openshift-gitops",
},
}
Expect(k8sClient.Create(ctx, rm)).To(Succeed())

By("verifying deplyment exists")
deplName := "argo-rollouts"
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
Eventually(depl).Should(k8sFixture.ExistByName())
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))

By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)

})

It("creates a cluster-scopes Argo Rollouts instance and verifies the CR value imagePullPolicy is applied", func() {

By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace with imagePullPolicy set to Always")

rm := &rolloutmanagerv1alpha1.RolloutManager{
ObjectMeta: metav1.ObjectMeta{
Name: "example-rollout-manager",
Namespace: "openshift-gitops",
},
Spec: rolloutmanagerv1alpha1.RolloutManagerSpec{
ImagePullPolicy: corev1.PullAlways,
},
}
Expect(k8sClient.Create(ctx, rm)).To(Succeed())

By("verifying deplyment exists")
deplName := "argo-rollouts"
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
Eventually(depl).Should(k8sFixture.ExistByName())
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))

By("verifying deployment has ImagePullPolicy set to the CR value(Always)")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)

By("updating the RolloutManager CR to set imagePullPolicy to Never")
patch := client.MergeFrom(rm.DeepCopy())
rm.Spec.ImagePullPolicy = corev1.PullNever
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())

By("verifying deployment has ImagePullPolicy set to the CR value(Never)")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to Never", deplName)

By("Removing the imagePullPolicy from the CR and check if the deployment has the imagePullPolicy set to default(IfNotPresent)")
rm.Spec.ImagePullPolicy = ""
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())

By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)
})

It("creates a cluster-scopes Argo Rollouts instance and verifies subscription image pull policy is applied", func() {
if fixture.EnvLocalRun() {
Skip("This test does not support local run, as when the controller is running locally there is no env var to modify")
return
}

By("setting the IMAGE_PULL_POLICY environment variable to Always")
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Always")
defer func() {
By("removing IMAGE_PULL_POLICY environment variable to restore default behavior")
fixture.RestoreSubcriptionToDefault()
}()

By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace")
rm := &rolloutmanagerv1alpha1.RolloutManager{
ObjectMeta: metav1.ObjectMeta{
Name: "example-rollout-manager",
Namespace: "openshift-gitops",
},
}
Expect(k8sClient.Create(ctx, rm)).To(Succeed())

By("verifying deplyment exists")
deplName := "argo-rollouts"
depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}}
Eventually(depl).Should(k8sFixture.ExistByName())
Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1))

By("verifying deployment has ImagePullPolicy set to Always")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)

By("changing the subscription image pull policy to Never")
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Never")

By("verifying deployment has ImagePullPolicy set to Never")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to Never", deplName)

By("changing the subscription image pull policy to IfNotPresent")
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "IfNotPresent")

By("verifying deployment has ImagePullPolicy set to IfNotPresent")
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName)

By("setting imagePullPolicy in CR and verify if the deployment has the imagePullPolicy set to the CR value")
patch := client.MergeFrom(rm.DeepCopy())
rm.Spec.ImagePullPolicy = corev1.PullAlways
Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed())
Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways, depl), "3m", "5s").Should(BeTrue(),
"Deployment %s should have all containers with ImagePullPolicy set to Always", deplName)

})

})

})