Skip to content

argocd: Add Open in Argo CD Application action - #1185

Open
Joshna907 wants to merge 3 commits into
headlamp-k8s:mainfrom
Joshna907:codex/argocd-open-in-ui
Open

argocd: Add Open in Argo CD Application action#1185
Joshna907 wants to merge 3 commits into
headlamp-k8s:mainfrom
Joshna907:codex/argocd-open-in-ui

Conversation

@Joshna907

Copy link
Copy Markdown
Contributor

Summary

This PR adds a safe Open in Argo CD action to the existing Argo CD Application detail header. The Argo icon opens the exact Application in the configured native Argo CD UI in a new browser tab.

Why

Headlamp provides Kubernetes-native visibility and operations. Argo CD's own UI remains the right place for advanced diffs, diagnostics, and resource actions. This gives operators a safe direct path from an Application in Headlamp to that same Application in Argo CD.

Changes

  • Added optional status.controllerNamespace metadata and an Application getter.
  • Reads only the argocd-cm ConfigMap using Headlamp's public ConfigMap API.
  • Looks up the ConfigMap in status.controllerNamespace, falling back to the Application namespace.
  • Shows the action only when argocd-cm.data.url is a valid absolute HTTP or HTTPS URL.
  • Safely builds /applications/<namespace>/<name> URLs, preserving configured installation paths and encoding names.
  • Rejects unsafe, malformed, relative, credential-bearing, or missing-host URLs.
  • Opens the external UI with noopener,noreferrer.
  • Documents the optional least-privilege ConfigMap permission and adds a fake local test manifest.

Validation

  • Prettier formatting check passed.
  • ESLint passed with zero warnings.
  • TypeScript passed with no emit.
  • All 6 test files and 45 tests passed.
  • Production build passed.

Manual test

  • Configured a local Argo CD UI URL.
  • Confirmed the Argo icon appears beside Sync and Refresh on the Application detail page.
  • Confirmed it opens the exact guestbook Application in the native Argo CD UI.
  • Confirmed native Argo CD authentication, application tree, and advanced actions remain handled by Argo CD itself.

Permissions

The optional action requires only:

- apiGroups: [""]
  resources: ["configmaps"]
  resourceNames: ["argocd-cm"]
  verbs: ["get"]

When the ConfigMap is unavailable, forbidden, missing a URL, or contains an invalid URL, the action is simply hidden.

Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>
Signed-off-by: Joshna907 <joshnawaikar@gmail.com>

Copilot AI 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.

Pull request overview

Adds a safe external link from Application details to the corresponding Argo CD UI page.

Changes:

  • Resolves and validates the configured Argo CD URL.
  • Adds the detail-header action with comprehensive tests.
  • Documents optional RBAC and local testing configuration.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
argocd/test-files/deploy/argocd-cm.yaml Adds mock UI configuration.
argocd/src/resources/application.ts Exposes the controller namespace.
argocd/src/resources/application.test.ts Tests the new accessor.
argocd/src/components/applications/openInArgoCD.tsx Implements URL validation and external action.
argocd/src/components/applications/openInArgoCD.test.tsx Tests URL safety and action behavior.
argocd/src/components/applications/Detail.tsx Adds the action to Application details.
argocd/src/components/applications/Detail.test.tsx Verifies header action integration.
argocd/README.md Documents behavior, permissions, and testing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants