Skip to content

fix: hub SliceGw controller logs r.ClusterName instead of package-level clusterName#487

Open
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:fix/slicegw-hub-controller-uses-package-var-clustername
Open

fix: hub SliceGw controller logs r.ClusterName instead of package-level clusterName#487
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:fix/slicegw-hub-controller-uses-package-var-clustername

Conversation

@mdryaan
Copy link
Copy Markdown

@mdryaan mdryaan commented May 24, 2026

Description

In pkg/hub/controllers/slicegateway_controller.go, the cluster ownership check correctly uses r.ClusterName (the value injected into the reconciler at startup):

if sliceGw.Spec.LocalGatewayConfig.ClusterName != r.ClusterName {

But the log.Info on the next line was using clusterName — the package-level variable initialised from os.Getenv("CLUSTER_NAME") at package load time. If the env var is empty or unset when the package initialises, the log prints an empty string while the comparison uses the correct injected value. The two variables can diverge, making the log line misleading during debugging.

Fix: replace clusterName with r.ClusterName in the log.Info call so the logged valueis always the same authoritative value used for the ownership check.

Fixes #13

How Has This Been Tested?

  • make fmt — no formatting changes
  • make vet — no issues
  • make build — builds cleanly

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have ran go fmt
  • I have updated the helm chart as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit test cases.
  • I have verified the E2E test cases with new code changes.
  • I have added all the required E2E test cases.

Does this PR introduce a breaking change?


…iceGw log

Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
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.

1 participant