Skip to content

feat: decouple console plugin from default ArgoCD instance #1231

Open
Rizwana777 wants to merge 1 commit 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 1 commit 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 5fd95d24-559d-4b34-a0e1-756624a58704

📥 Commits

Reviewing files that changed from the base of the PR and between 07b5c1e and 7cc0707.

📒 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
  • controllers/gitopsservice_controller_test.go
  • test/openshift/e2e/ginkgo/sequential/1-115_validate_imagepullpolicy_console_plugin_test.go
  • cmd/main.go
  • test/e2e/suite_test.go
  • test/openshift/e2e/ginkgo/sequential/1-085_validate_dynamic_plugin_installation_test.go
  • controllers/consoleplugin_test.go
  • test/nondefaulte2e/suite_test.go
  • controllers/consoleplugin.go
  • test/openshift/e2e/ginkgo/sequential/1-123_validate_list_order_comparison_test.go
  • controllers/gitopsservice_controller.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Console plugin resources (Deployment, ConsolePlugin, Service, ConfigMap) are now created in the operator-configured namespace.
    • The operator detects the runtime namespace automatically (with a default fallback) and ensures it exists when needed.
  • Bug Fixes
    • Improved console plugin reconciliation so updates apply to the correct existing resource.
    • Added cleanup to remove old plugin resources when the configured namespace changes.
  • Tests
    • Added/updated e2e and OpenShift scenarios to validate plugin placement, backend namespace, image pull policy, resource constraints, and cleanup behavior.

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
cmd/main.go, controllers/gitopsservice_controller.go, test/e2e/suite_test.go, test/nondefaulte2e/suite_test.go
The reconciler receives a PluginNamespace derived from the service-account namespace, with a default fallback when unavailable.
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 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

🚥 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 away from the default ArgoCD instance.
Description check ✅ Passed The description matches the namespace migration, reconciler updates, cleanup, and test changes in the PR.
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.

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 from 91e8e6d to 07b5c1e Compare July 23, 2026 06:56
…-by: Claude

Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
@Rizwana777
Rizwana777 force-pushed the decouple-gitops-plugin-from-default-argocd branch 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

@openshift-ci

openshift-ci Bot commented Jul 23, 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.19-kuttl-sequential 7cc0707 link true /test v4.19-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.

1 participant