Skip to content

backend/frontend/charts: make in-cluster context name configurable#4362

Merged
illume merged 8 commits intokubernetes-sigs:mainfrom
iamhalje:in-cluster-context-name
Jan 29, 2026
Merged

backend/frontend/charts: make in-cluster context name configurable#4362
illume merged 8 commits intokubernetes-sigs:mainfrom
iamhalje:in-cluster-context-name

Conversation

@iamhalje
Copy link
Contributor

Summary

this PR makes Headlamp's in-cluster cluster name configurable and includes the selected cluster name in the browser tab title. (this help with to many tabs)

  • In-cluster mode currently shows the cluster as main in the UI, this change allow overriding that name at runtime.
  • Including the active cluster name in the title makes it easier to distinguish tabs when working with multiple headlamps tabs.

Related Issue

Fixes #4346

Changes

Backend:

  • Add --in-cluster-context-name / HEADLAMP_CONFIG_IN_CLUSTER_CONTEXT_NAME to override the in-clustter context name (default main).

Frontend:

  • Upgrade age title logic to include the current cluster name

Steps to Test

  1. Run Headlamp in-clkuster mode with a custon cluster name, for example: headlamp-server --in-cluster --in-cluster-context-name=dev
  2. Open the UI and veirfy the cluster name shows as dev instead of main.
  3. Navigate between pages and veirfy the browser tab title is: <cluster> - <page> (or when page title is empty)

Screenshots (if applicable)

image

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 16, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 16, 2026
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 16, 2026
@illume illume requested a review from Copilot January 18, 2026 15:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the in-cluster context name configurable in Headlamp and enhances the browser tab title to include the active cluster name, addressing the need for better multi-cluster environment support.

Changes:

  • Added --in-cluster-context-name CLI flag (default: "main") to customize the in-cluster context name
  • Updated browser tab title format to include cluster name: <cluster> - <page>
  • Renamed constant from InClusterContextName to DefaultInClusterContextName for clarity

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/components/App/RouteSwitcher.tsx Modified PageTitle component to include cluster name in browser tab title
backend/pkg/kubeconfig/kubeconfig.go Renamed constant and added contextName parameter to GetInClusterContext function with empty string handling
backend/pkg/headlampconfig/headlampConfig.go Added InClusterContextName field to HeadlampCFG struct with documentation
backend/pkg/config/config.go Added InClusterContextName field and CLI flag definition with default value "main"
backend/cmd/server.go Passed InClusterContextName from config to HeadlampConfig
backend/cmd/headlamp.go Added InClusterContextName field and passed it to GetInClusterContext function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good a first glance. Thanks a lot!

@iamhalje can you please rebase the PR against main branch? It seems like some older commits are mixed in here. Also please get rid of the merge commit.

Please see Commit Guidelines , we follow a linux kernel style of commit messages.

For example:

frontend: HomeButton: Fix so it navigates to home
backend: config: Add enable-dynamic-clusters flag

Seems there's some lint issue in the backend/ code (I think it is just a comment typo). You can run the linter locally like this:

npm run backend:lint
npm run backend:format

@illume illume added kind/feature Categorizes issue or PR as related to a new feature. backend Issues related to the backend frontend Issues related to the frontend dashboard labels Jan 18, 2026
@iamhalje iamhalje force-pushed the in-cluster-context-name branch from 21d9b0e to 4615b04 Compare January 18, 2026 16:27
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 18, 2026
@iamhalje iamhalje force-pushed the in-cluster-context-name branch 3 times, most recently from 935208a to 32f065e Compare January 18, 2026 17:15
@illume illume requested a review from Copilot January 18, 2026 17:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iamhalje iamhalje force-pushed the in-cluster-context-name branch from 015f89b to 32f065e Compare January 18, 2026 17:47
@iamhalje
Copy link
Contributor Author

@illume fixed, can rerun pipelines

@iamhalje
Copy link
Contributor Author

@illume I can finish this today and fix remaining issues

@illume illume requested a review from Copilot January 18, 2026 19:22
@illume illume added this to the v0.40.0 milestone Jan 24, 2026
@iamhalje iamhalje force-pushed the in-cluster-context-name branch 2 times, most recently from d5369fd to cb8a463 Compare January 24, 2026 20:35
@iamhalje
Copy link
Contributor Author

@illume fixed all

@iamhalje iamhalje changed the title backend/frontend: make in-cluster context name configurable backend/frontend/charts: make in-cluster context name configurable Jan 25, 2026
@iamhalje iamhalje force-pushed the in-cluster-context-name branch 2 times, most recently from 023162b to 044867f Compare January 25, 2026 06:12
@iamhalje
Copy link
Contributor Author

@illume bump

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @iamhalje

It seems the chart test is failing in the github check.

You can run it locally like this:
make helm-template-test

Template test FAILED for ./charts/headlamp/values.yaml against ./charts/headlamp/tests/expected_templates/default.yaml:
--- ./charts/headlamp/tests/defaultvaluetest/rendered_templates.yaml	2026-01-26 16:18:43.176857421 +0000
+++ ./charts/headlamp/tests/expected_templates/default.yaml	2026-01-26 16:18:40.210852348 +0000
@@ -109,7 +109,6 @@
           env:
           args:
             - "-in-cluster"
-            - "-in-cluster-context-name=main"
             - "-plugins-dir=/headlamp/plugins"
             # Check if externalSecret is disabled
           ports:

Please squash or rebase this merge main commit out?

@iamhalje iamhalje force-pushed the in-cluster-context-name branch from 8a4db75 to 45e85ea Compare January 26, 2026 16:50
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 26, 2026
@iamhalje iamhalje force-pushed the in-cluster-context-name branch from 45e85ea to c7ccea1 Compare January 26, 2026 16:53
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 26, 2026
@iamhalje
Copy link
Contributor Author

@illume helm-template-test passed

@iamhalje
Copy link
Contributor Author

@illume what need to be done to get lgtm label?

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 thanks!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamhalje, illume

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2026
@illume illume merged commit 2084fc5 into kubernetes-sigs:main Jan 29, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. backend Issues related to the backend cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. dashboard frontend Issues related to the frontend kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give the possibility to configure cluster name header in InCluster mode

3 participants