Skip to content

improvement(service): replace duplicate checkForProjectNamespace methods with util.CheckForProjectNamespace#385

Open
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:improvement/remove-checkforprojectnamespace-duplication
Open

improvement(service): replace duplicate checkForProjectNamespace methods with util.CheckForProjectNamespace#385
mdryaan wants to merge 1 commit into
kubeslice:masterfrom
mdryaan:improvement/remove-checkforprojectnamespace-duplication

Conversation

@mdryaan

@mdryaan mdryaan commented May 17, 2026

Copy link
Copy Markdown

Description

Three service structs (ClusterService, SliceConfigService, SliceQoSConfigService) each defined a private checkForProjectNamespace(*corev1.Namespace) bool method with an identical body. The same check already exists as the public util.CheckForProjectNamespace in util/reconciliation_utility.go. All three private methods were removed and their single call sites updated to call util.CheckForProjectNamespace directly. The fmt import in slice_qos_config_service.go was also removed as it was only used by the deleted method. Net change: −19 lines, no behaviour change.

Fixes #384

How Has This Been Tested?

Removed checkForProjectNamespace from cluster_service.go:337–339, slice_config_service.go:245–247, and slice_qos_config_service.go:127–129. Updated call sites at cluster_service.go:75, slice_config_service.go:131, and slice_qos_config_service.go:113 to call util.CheckForProjectNamespace. Removed unused fmt import from slice_qos_config_service.go. go build ./... passes. Pre-existing make vet failure (undefined: util.Client in access_control_service_test.go) exists on master before this branch and is unrelated to this change.

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? — No.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas. — N/A.
  • I have tested it for all user roles. — N/A.
  • I have added all the required unit test cases.

Does this PR introduce a breaking change for other components like worker-operator?

No

Remove duplicate checkForProjectNamespace private methods from ClusterService, SliceConfigService, and SliceQoSConfigService; use shared  util.CheckForProjectNamespace instead

  duplicate checkForProjectNamespace methods with util.CheckForProjectNamespace

Signed-off-by: mdryaan <alikhurshid4u@gmail.com>
@mdryaan mdryaan requested a review from that-backend-guy as a code owner May 17, 2026 14:22
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.

Improvement: checkForProjectNamespace duplicated in three services instead of using existing util.CheckForProjectNamespace

1 participant