Skip to content

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

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

BRGOVIND wants to merge 2 commits 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.

@BRGOVIND

Copy link
Copy Markdown
Author

Hi @sudermanjr @transient1 — friendly ping! This PR has been open for 4 days. The unit tests and lint are passing on CircleCI. The tests workflow failure and pending E2E checks are fork-related (Docker registry credentials from org-global context aren't available for fork PRs) and unrelated to the code changes.

Would love to get a review when you have a moment. Happy to make any adjustments!

@github-actions github-actions Bot added the stale Marked as stale by stalebot label Aug 18, 2026
@sudermanjr
sudermanjr requested a review from Azahorscak as a code owner August 18, 2026 13:46
@sudermanjr sudermanjr self-assigned this Aug 18, 2026
@sudermanjr sudermanjr removed the stale Marked as stale by stalebot label Aug 18, 2026
@sudermanjr

Copy link
Copy Markdown
Member

Thanks for the PR! Sorry for the slow uptake on our end.

This particular set of issues is not currently covered by any of the tests, so it will need to be verified manually, or tests will need to be added to cover it.

Can you either add some tests, or provide some screenshots of the desired behavior for each of the three scenarios?

@BRGOVIND

Copy link
Copy Markdown
Author

Thanks for the PR! Sorry for the slow uptake on our end.

This particular set of issues is not currently covered by any of the tests, so it will need to be verified manually, or tests will need to be added to cover it.

Can you either add some tests, or provide some screenshots of the desired behavior for each of the three scenarios?

Thanks for taking a look, @sudermanjr!
I’ll add unit tests covering the three namespace discovery scenarios:

OnByDefault=true → namespaces discovered from Goldilocks-created VPAs
ShowAllVPAs=true → namespaces discovered from all VPAs
Default mode → namespaces discovered from goldilocks.fairwinds.com/enabled=true

I’ll also make sure the tests cover the expected filtering and alphabetical sorting of the returned namespaces.
I’ll push the tests to this PR once they’re ready.

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

3 participants