Skip to content

test: validate readOnlyRootFilesystem on GitOps workloads (GITOPS-7256) - #1585

Open
Naveena-058 wants to merge 2 commits into
redhat-developer:masterfrom
Naveena-058:GITOPS-7256-validate-read-only-root-filesystem
Open

Naveena-058 wants to merge 2 commits into
redhat-developer:masterfrom
Naveena-058:GITOPS-7256-validate-read-only-root-filesystem

Conversation

@Naveena-058

Copy link
Copy Markdown
Contributor

What does this PR do?
Adds a parallel Ginkgo e2e test for GITOPS-7256 that verifies GitOps-owned Deployments and StatefulSets explicitly set securityContext.readOnlyRootFilesystem: true (requirement from GITOPS-6239).

Also sets ReadOnlyRootFilesystem: true on the gitops-plugin container securityContext so the default OpenShift install path matches the same requirement.

PR acceptance criteria:

  • Documentation was updated and verified using make serve-docs
  • Unit tests were updated
  • E2E tests were updated

What type of PR is this?

/kind enhancement

Special notes to the reviewer:

  • New test: test/openshift/e2e/ginkgo/parallel/1-145_validate_read_only_root_filesystem_test.go
    • Custom namespace-scoped Argo CD instance (always)
    • openshift-gitops + openshift-gitops-operator workloads (Label("openshift"))
  • Workloads are filtered by GitOps ownership labels so Application-deployed resources in the same namespace are skipped
  • OpenShift default-install case expects an operator build that includes the gitops-plugin securityContext change

Add parallel e2e coverage for Argo CD and operator workloads, and set
readOnlyRootFilesystem on the gitops-plugin securityContext.

Signed-off-by: NAVEENA S <nas@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci openshift-ci Bot added the kind/enhancement New feature or request label Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Security

    • GitOps plugin containers now use a read-only root filesystem, restricting changes to the container’s filesystem while they run.
    • This setting is applied to the plugin’s security context alongside its existing volume and security-context configuration.
  • Tests

    • Added end-to-end checks that verify GitOps-managed Deployment and StatefulSet containers use read-only root filesystems. These checks cover both namespace-scoped Argo CD instances and the OpenShift GitOps installation.

The console plugin security context now sets ReadOnlyRootFilesystem to true. New E2E tests check that GitOps-owned Deployment and StatefulSet containers set this option.

Changes: Read-only root filesystem

Layer / File(s) Summary
Console plugin security context
controllers/consoleplugin.go
The console plugin sets ReadOnlyRootFilesystem to true. It also uses ptr.To for volume mode and security-context pointer values.
E2E workload validation
test/openshift/e2e/ginkgo/parallel/1-145_validate_read_only_root_filesystem_test.go
Tests select GitOps-owned Deployments and StatefulSets, then check the setting on each init and regular container. One test creates a namespace-scoped Argo CD instance; another checks workloads in the openshift-gitops and openshift-gitops-operator namespaces.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant ArgoCD
  participant Kubernetes
  E2ETest->>ArgoCD: Create namespace-scoped instance
  ArgoCD->>Kubernetes: Create managed workloads
  E2ETest->>Kubernetes: List Deployments and StatefulSets
  Kubernetes-->>E2ETest: Return workload pod templates
  E2ETest->>E2ETest: Check selected containers for read-only root filesystem
Loading

Suggested reviewers: jgwest, ciiay

Merge Risk: Minimal · up to b7e73

The console plugin container now sets a read-only root filesystem, and a new E2E test checks the setting on GitOps-owned workloads. No blocking issue was found. The plugin image's runtime write paths could not be inspected, so confirm the plugin pod starts on a cluster when you test the default install.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'test: validate readOnlyRootFilesystem on GitOps workloads (GITOPS-7256)' matches the main change. The PR adds an e2e test that checks GitOps-owned Deployments and StatefulSets set readOnlyR…
Description check Passed The description states the new parallel Ginkgo e2e test for GITOPS-7256, the gitops-plugin securityContext change, the workload filtering by GitOps ownership labels, and the OpenShift default-install …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title 'test: validate readOnlyRootFilesystem on GitOps workloads (GITOPS-7256)' matches the main change. The PR adds an e2e test that checks GitOps-owned Deployments and StatefulSets set readOnlyRootFilesystem to true. It also sets ReadOnlyRootFilesystem on the gitops-plugin container, which the title does not mention. That secondary change is minor relative to the test addition.

Full details: Description check

Explanation

The description states the new parallel Ginkgo e2e test for GITOPS-7256, the gitops-plugin securityContext change, the workload filtering by GitOps ownership labels, and the OpenShift default-install caveat. This matches the changeset.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bc70593 and b7e73d9.

Files selected for processing: 1

  • controllers/consoleplugin.go
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Files skipped from review as they are similar to previous changes: 1

  • controllers/consoleplugin.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Signed-off-by: NAVEENA S <nas@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
AllowPrivilegeEscalation: new(false),
RunAsNonRoot: ptr.To(true),
AllowPrivilegeEscalation: ptr.To(false),
ReadOnlyRootFilesystem: ptr.To(true),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer new to ptr.To. That is the direction the codebase is evolving.


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

Context("1-145_validate_read_only_root_filesystem", func() {

@olivergondza olivergondza Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reimplement as an extension to https://github.com/redhat-developer/gitops-operator/blob/9e27b0caba263123cd22d8afa22a249d9ea6d181/test/openshift/e2e/ginkgo/parallel/1-064_validate_deployment_attributes_test.go. It will keep similar things together.

I like your detection through isGitOpsOwnedWorkload, might be worth incorporating there instead of a hardcoded deployment list.

@openshift-ci

openshift-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown

@Naveena-058: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v4.22-kuttl-parallel b7e73d9 link true /test v4.22-kuttl-parallel
ci/prow/v4.18-kuttl-parallel b7e73d9 link false /test v4.18-kuttl-parallel
ci/prow/v4.18-kuttl-sequential b7e73d9 link false /test v4.18-kuttl-sequential
ci/prow/v4.22-kuttl-sequential b7e73d9 link true /test v4.22-kuttl-sequential

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants