Skip to content

feat: decouple console plugin from default ArgoCD instance - #1231

Open
Rizwana777 wants to merge 2 commits into
redhat-developer:masterfrom
Rizwana777:decouple-gitops-plugin-from-default-argocd
Open

feat: decouple console plugin from default ArgoCD instance #1231
Rizwana777 wants to merge 2 commits into
redhat-developer:masterfrom
Rizwana777:decouple-gitops-plugin-from-default-argocd

Conversation

@Rizwana777

Copy link
Copy Markdown
Collaborator

What type of PR is this?
/kind enhancement

What does this PR do / why we need it:
Moves console plugin resources (Deployment, Service, ConfigMap) from 'openshift-gitops' namespace to the operator's own namespace (openshift-gitops-operator) so the plugin operates independently of the default ArgoCD instance. This is a prerequisite for allowing the default ArgoCD instance to be disabled without breaking the console plugin.

  • Made plugin functions support namespaces.
  • Added 'PluginNamespace' field to the reconciler, resolved from the operator's serviceaccount namespace
  • Added cleanup of old plugin resources from 'openshift-gitops'
  • Ensures plugin namespace exists before creating resources
  • ConsolePlugin CR backend now points to the operator namespace

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?

Test acceptance criteria:

  • Unit Test
  • E2E Test

How to test changes / Special notes to the reviewer:
make install
make run

  • kubectl get deployment gitops-plugin -n openshift-gitops-operator
    NAME READY UP-TO-DATE AVAILABLE AGE
    gitops-plugin 1/1 1 1 19m

  • kubectl get service gitops-plugin -n openshift-gitops-operator
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    gitops-plugin ClusterIP 172.xyz.83 9001/TCP 19m

  • kubectl get configmap httpd-cfg -n openshift-gitops-operator
    NAME DATA AGE
    httpd-cfg 1 20m

  • kubectl get consoleplugin gitops-plugin -o jsonpath='{.spec.backend.service.namespace}'
    openshift-gitops-operator

@openshift-ci openshift-ci Bot added the kind/enhancement New feature or request label Jul 22, 2026
@openshift-ci
openshift-ci Bot requested review from AdamSaleh and chetan-rns July 22, 2026 11:24
@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jgwest for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The operator derives a plugin namespace from the service-account namespace, configures reconciliation with it, creates plugin resources there, removes legacy resources from the previous namespace, and adds controller and E2E coverage for the resulting placement.

Changes

Console plugin namespace migration

Layer / File(s) Summary
Plugin namespace configuration
controllers/util/util.go, cmd/main.go, controllers/gitopsservice_controller.go, test/e2e/suite_test.go, test/nondefaulte2e/suite_test.go
The plugin namespace is read from the service-account namespace file, defaulted when absent, and passed into production and E2E reconciler instances.
Namespace-aware resource reconciliation
controllers/consoleplugin.go, controllers/gitopsservice_controller.go, controllers/consoleplugin_test.go, controllers/gitopsservice_controller_test.go
Deployment, Service, ConsolePlugin, and ConfigMap resources use the configured namespace; reconciliation creates it, updates the fetched ConsolePlugin, and deletes legacy resources from the old namespace.
Operator namespace E2E validation
test/openshift/e2e/ginkgo/sequential/*
E2E tests target plugin resources in openshift-gitops-operator, validate namespace-specific behavior, and verify resources are absent from openshift-gitops.

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

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant ReconcileGitopsService
  participant KubernetesAPI
  participant reconcilePlugin
  participant cleanupOldPluginResources
  Operator->>ReconcileGitopsService: provide PluginNamespace
  ReconcileGitopsService->>KubernetesAPI: create namespace when needed
  ReconcileGitopsService->>reconcilePlugin: reconcile resources in PluginNamespace
  ReconcileGitopsService->>cleanupOldPluginResources: remove legacy resources
  cleanupOldPluginResources->>KubernetesAPI: delete old plugin resources
Loading

Suggested reviewers: adamsaleh, chetan-rns, anandrkskd

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving the console plugin off the default ArgoCD namespace.
Description check ✅ Passed The description matches the implemented namespace migration, cleanup, and reconciler updates described in the changeset.
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.

Warning

Review ran into problems

🔥 Problems

Repository analysis: Couldn't refresh redhat-developer/gitops-operator clone - clone failed: Clone operation failed: Stream initialization permanently failed: 14 UNAVAILABLE: read ECONNRESET


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controllers/consoleplugin.go`:
- Line 455: Update the migration flow around consolePlugin so the fetched
existingPlugin receives the desired fields from newConsolePlugin before the
update is submitted. Use existingPlugin for the Kubernetes update, preserving
its resourceVersion, rather than updating the newly constructed object; ensure
the CR is updated before deleting the old Service.

In `@controllers/gitopsservice_controller.go`:
- Line 321: Move the cleanupOldPluginResources call out of the pre-version-gate
path and invoke it only after replacement resource reconciliation completes
successfully. Ensure unsupported clusters and target-resource creation failures
leave legacy resources intact, and propagate any cleanupOldPluginResources error
so reconciliation retries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 7f53c0bc-d230-4f9b-b873-8d1cd1a58751

📥 Commits

Reviewing files that changed from the base of the PR and between 6103be5 and e8d9721.

📒 Files selected for processing (8)
  • cmd/main.go
  • controllers/consoleplugin.go
  • controllers/consoleplugin_test.go
  • controllers/gitopsservice_controller.go
  • controllers/gitopsservice_controller_test.go
  • test/e2e/suite_test.go
  • test/nondefaulte2e/suite_test.go
  • test/openshift/e2e/ginkgo/sequential/1-124_validate_console_plugin_in_operator_namespace_test.go
🔗 Linked repositories identified

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

  • argoproj-labs/argocd-operator (manual)

Comment thread controllers/consoleplugin.go
Comment thread controllers/gitopsservice_controller.go Outdated
@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch from e8d9721 to 91e8e6d Compare July 22, 2026 11:37
@Rizwana777

Copy link
Copy Markdown
Collaborator Author

/test v4.14-ci-index-gitops-operator-bundle

@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch 2 times, most recently from 07b5c1e to 7cc0707 Compare July 23, 2026 06:58
@Rizwana777

Copy link
Copy Markdown
Collaborator Author

/test v4.14-kuttl-sequential

@Rizwana777

Copy link
Copy Markdown
Collaborator Author

/test v4.14-e2e

@Rizwana777

Copy link
Copy Markdown
Collaborator Author

/test v4.19-kuttl-sequential

Comment thread controllers/consoleplugin.go Outdated
Comment thread controllers/consoleplugin.go Outdated
Comment thread controllers/consoleplugin.go Outdated
Comment thread controllers/gitopsservice_controller.go Outdated

@anandrkskd anandrkskd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some nit comments, changes LGTM

Comment thread controllers/consoleplugin.go Outdated
Comment thread cmd/main.go Outdated
…-by: Claude

Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch from 7cc0707 to 42765d3 Compare July 28, 2026 11:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
controllers/consoleplugin.go (1)

138-158: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Put the runtime-namespace label on the pod template.

kubeAppLabelRuntimeNamespace is currently added to Deployment.ObjectMeta.Labels at Line 158, while Spec.Template.ObjectMeta.Labels still contains only kubeAppLabelApp. Pods therefore do not receive the namespace label, contrary to the deployment reconciliation contract covered by controllers/consoleplugin_test.go.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/consoleplugin.go` around lines 138 - 158, Add
kubeAppLabelRuntimeNamespace with the namespace value to the pod template labels
in pluginDeployment, alongside kubeAppLabelApp. Keep the existing
Deployment.ObjectMeta label unchanged so both the Deployment and its Pods
receive the runtime-namespace label required by reconciliation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controllers/consoleplugin.go`:
- Line 415: Update both reconciliation paths in controllers/consoleplugin.go: at
lines 415-415, submit the fetched existingServiceRef after applying mutations
instead of the fresh pluginServiceRef; at lines 492-492, submit the fetched
existingPluginConfigMap instead of a newly constructed desired object. Preserve
the existing namespace-aware update behavior and resource metadata from the
fetched resources.

---

Outside diff comments:
In `@controllers/consoleplugin.go`:
- Around line 138-158: Add kubeAppLabelRuntimeNamespace with the namespace value
to the pod template labels in pluginDeployment, alongside kubeAppLabelApp. Keep
the existing Deployment.ObjectMeta label unchanged so both the Deployment and
its Pods receive the runtime-namespace label required by reconciliation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: cf4f56e1-ca8a-4364-8325-feced152e39a

📥 Commits

Reviewing files that changed from the base of the PR and between 7cc0707 and 42765d3.

📒 Files selected for processing (12)
  • cmd/main.go
  • controllers/consoleplugin.go
  • controllers/consoleplugin_test.go
  • controllers/gitopsservice_controller.go
  • controllers/gitopsservice_controller_test.go
  • test/e2e/suite_test.go
  • test/nondefaulte2e/suite_test.go
  • test/openshift/e2e/ginkgo/sequential/1-085_validate_dynamic_plugin_installation_test.go
  • test/openshift/e2e/ginkgo/sequential/1-115_validate_imagepullpolicy_console_plugin_test.go
  • test/openshift/e2e/ginkgo/sequential/1-121-valiate_resource_constraints_gitopsservice_test.go
  • test/openshift/e2e/ginkgo/sequential/1-123_validate_list_order_comparison_test.go
  • test/openshift/e2e/ginkgo/sequential/1-124_validate_console_plugin_in_operator_namespace_test.go
🔗 Linked repositories identified

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

  • argoproj-labs/argocd-operator (manual)
🚧 Files skipped from review as they are similar to previous changes (11)
  • test/openshift/e2e/ginkgo/sequential/1-124_validate_console_plugin_in_operator_namespace_test.go
  • test/openshift/e2e/ginkgo/sequential/1-115_validate_imagepullpolicy_console_plugin_test.go
  • controllers/consoleplugin_test.go
  • controllers/gitopsservice_controller_test.go
  • test/e2e/suite_test.go
  • cmd/main.go
  • test/openshift/e2e/ginkgo/sequential/1-085_validate_dynamic_plugin_installation_test.go
  • test/openshift/e2e/ginkgo/sequential/1-121-valiate_resource_constraints_gitopsservice_test.go
  • test/openshift/e2e/ginkgo/sequential/1-123_validate_list_order_comparison_test.go
  • controllers/gitopsservice_controller.go
  • test/nondefaulte2e/suite_test.go

Comment thread controllers/consoleplugin.go
@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch from a5e2b9d to 0359154 Compare July 28, 2026 12:45
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch from 0359154 to 0337564 Compare July 28, 2026 17:52
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Rizwana777: The following test 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.14-kuttl-sequential 0337564 link false /test v4.14-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