Skip to content

ArgoCD cards show Demo mode even when ArgoCD is deployed and running #4201

@Abhishek-Punhani

Description

@Abhishek-Punhani

User Request

Type: bug
Target: Console Application
Submitted by: @Abhishek-Punhani
Console Request ID: c3d558bc-7d35-4ac0-ab1e-21dcfc4a6d53

Description

ArgoCD cards (especially ArgoCD Applications) can incorrectly show demo data + demo badge even when ArgoCD is installed and healthy in the cluster.

Observed by user:

  • ArgoCD pods are all Running in argocd namespace (kubectl get po -A confirms).
  • UI still shows Demo badge and mock-looking app list (api-gateway, monitoring-stack, etc.).
  • Integration banner (Install ArgoCD...) is shown even in this live cluster context.

Impact

  • False impression that ArgoCD is not installed.
  • Users cannot trust card state or data provenance.
  • Operational decision-making is affected (live GitOps status hidden behind mock fallback).

Affected files

Current behavior (from implementation)

1) Hook falls back to mock data aggressively

In useArgoCDApplications:

  • It calls /api/gitops/argocd/applications.
  • It accepts live data only when:
    • result.isDemoData === false and
    • result.items.length > 0
  • Otherwise it throws and falls back to getMockArgoApplications(clusterNames) with isDemoData=true.

This means demo can be shown for multiple non-demo situations:

  • backend endpoint unavailable/error,
  • backend returns { isDemoData: true },
  • backend returns empty items temporarily.

2) Argo cards always show integration banner

All three cards render the "ArgoCD Integration / Install ArgoCD" notice unconditionally (not gated by isDemoData or missing integration).

So even with live data, the card still implies ArgoCD needs installation.

3) Data source mismatch likely in local-agent workflows

useArgoCD uses backend /api/gitops/* only, and does not use local-agent data paths. If cluster data is available via local agent but backend GitOps endpoint is not ready/reachable, it still falls to demo.

Why user can reproduce despite healthy pods

kubectl confirms ArgoCD is running in-cluster, but UI demo mode is controlled by hook fetch path and response flags, not by pod existence. If /api/gitops/argocd/* cannot return live app data, the hook intentionally emits mock data.

Existing tests found

There are existing tests, but they miss critical live-vs-demo correctness scenarios:

Coverage gap highlights:

  • No robust test proving live API response suppresses demo fallback in real-world edge cases.
  • Tests currently assert integration banner rendering in live mode (which reinforces the incorrect UX).
  • No test ensuring banner is conditional on isDemoData/missing integration state.
  • No test asserting behavior when backend returns temporary empty list vs true demo fallback.

Expected behavior

  1. If ArgoCD live API is reachable with real data, card must not show demo badge.
  2. Integration/install banner should show only when appropriate (e.g., explicit demo mode or confirmed missing integration), not always.
  3. Empty live datasets should not automatically become synthetic mock datasets unless explicitly configured as demo fallback.
  4. If backend GitOps endpoint is unavailable but cluster connectivity exists, show clear error/limited state instead of silently replacing with mock data.

Proposed fix direction

  1. Tighten fallback policy in useArgoCD.ts:

    • Distinguish between:
      • explicit demo (isDemoData=true),
      • live empty result (items=[]),
      • backend failure.
    • Avoid auto-generating mock applications for live-empty or transient failures unless explicitly allowed.
  2. Make integration banner conditional in cards:

    • Render install/integration notice only when:
      • explicit demo fallback, or
      • confirmed ArgoCD not integrated.
    • Hide it for live data mode.
  3. Surface source/diagnostic state:

    • Expose a source state (live, demo, error) from hooks.
    • Cards use that state for badge and messaging.
  4. Optional: add local-agent fallback for ArgoCD data where feasible.

Test scenarios to add (detailed)

Hook tests (useArgoCD)

  1. Live API success (isDemoData=false, non-empty items) -> isDemoData=false, no mock generation.
  2. Live API success with empty items -> remains live empty state (not forced mock demo).
  3. API non-200 with { isDemoData:true } -> explicit demo state.
  4. API failure/network error -> error state (or controlled fallback), not silent fake apps by default.
  5. Cache contains demo data but fresh live response arrives -> switch to live.
  6. Cache contains live data and refresh fails transiently -> keep live stale data, avoid instant demo flip.
  7. Cluster list available but GitOps endpoint unavailable -> no false "Argo installed missing" inference.

Card tests (ArgoCDApplications, ArgoCDHealth, ArgoCDSyncStatus)

  1. Integration banner hidden in live mode.
  2. Integration banner visible only in demo/missing-integration mode.
  3. Demo badge appears only when hook marks demo.
  4. Live mode + empty data shows empty state message, not mock apps.
  5. Live mode + refresh error shows non-demo error/limited state text.
  6. Regression: with live data (api-gateway real object), card should not include canned mock set generated from clusters.

Acceptance criteria

  • ArgoCD cards do not show Demo when live ArgoCD data is available.
  • Integration banner is conditional and not always displayed.
  • Demo fallback does not mask live-empty or transient-error states.
  • Added tests cover live/demo/error/empty transitions and pass.

This issue was automatically created from the KubeStellar Console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-fix-requestedhelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.triage/neededNeeds triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions