Skip to content

dashboard: fix /namespaces page empty when on-by-default is set#861

Open
BRGOVIND wants to merge 1 commit into
FairwindsOps:masterfrom
BRGOVIND:fix/namespace-list-on-by-default
Open

dashboard: fix /namespaces page empty when on-by-default is set#861
BRGOVIND wants to merge 1 commit into
FairwindsOps:masterfrom
BRGOVIND:fix/namespace-list-on-by-default

Conversation

@BRGOVIND

Copy link
Copy Markdown

Fixes #855 — /namespaces dashboard page shows empty when --on-by-default is set on the controller.

Root cause

The /namespaces page and /dashboard page use different namespace discovery strategies:

Page Discovery method
/dashboard Lists VPA objects → extracts namespaces from them
/namespaces Lists Kubernetes namespaces by goldilocks.fairwinds.com/enabled label

When the controller runs with --on-by-default, it creates VPA objects for unlabelled namespaces. The /dashboard page works because it finds those VPAs. The /namespaces page fails because it looks for the label, which is absent.

Fix

When OnByDefault or ShowAllVPAs is set on the dashboard, switch /namespaces to use VPA-based discovery (the same source as /dashboard), making both pages consistent.

Mode /namespaces now uses
OnByDefault=true VPAs with Goldilocks labels (creator=Fairwinds, source=goldilocks)
ShowAllVPAs=true All VPAs (no label filter)
Default Namespace label goldilocks.fairwinds.com/enabled=true (unchanged)

Namespaces are returned sorted alphabetically.

The empty-state message in
amespace_list.gohtml is also updated so it gives accurate guidance for each mode instead of always suggesting kubectl label ns ....

Changes

  • pkg/dashboard/namespace-list.go — VPA-based discovery for OnByDefault/ShowAllVPAs modes
  • pkg/dashboard/templates/namespace_list.gohtml — context-aware empty-state message

When the Goldilocks controller runs with --on-by-default, it creates VPA
objects for namespaces that have no goldilocks.fairwinds.com/enabled label.
The /namespaces dashboard page uses label-based namespace discovery, so it
returns nothing and shows "No namespaces are labelled" even though the
controller is actively managing those namespaces.

The /dashboard page works correctly in this scenario because it discovers
namespaces from VPA objects directly (via summary.GetSummary), not from
namespace labels.

Fix: when OnByDefault or ShowAllVPAs is set, derive the namespace list from
VPA objects using the same VpaLabels filter that the /dashboard page uses.
This makes both pages consistent and removes the requirement to also set
--on-by-default on the dashboard when it is set on the controller.

- OnByDefault=true: lists VPAs with Goldilocks labels (creator=Fairwinds,
  source=goldilocks), extracts unique namespaces sorted alphabetically.
- ShowAllVPAs=true: lists all VPAs without label filter.
- Default: unchanged, queries namespace label goldilocks.fairwinds.com/enabled=true.

Also update the empty-state message in namespace_list.gohtml to give accurate
guidance for both modes.

Fixes FairwindsOps#855

Signed-off-by: B R GOVIND <brgovind2005@gmail.com>
@CLAassistant

CLAassistant commented Jun 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@BRGOVIND

Copy link
Copy Markdown
Author

The ci/circleci: test status check (lint + unit tests) is passing. The ests workflow check failure appears to be the snapshot job which requires Docker registry credentials from the org-global context — unavailable for PRs from forks. This is unrelated to the code changes.

Happy to rebase or adjust anything if needed for review.

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.

/namespaces dashboard page shows "no namespaces labelled" when running with --on-by-default=true

2 participants