Skip to content

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

Description

@mdryaaan

Problem:
Three service structs each define an identical private method checkForProjectNamespace(*corev1.Namespace) bool that does exactly the same check as the public util.CheckForProjectNamespace function that already exists in util/reconciliation_utility.go. Any change to this check must be made in four places instead of one. All three private methods use "Project" as a string literal whereas the util function correctly uses the util.ProjectKind constant.

Proposed Solution:
Delete the private method from all three services and replace each call site with util.CheckForProjectNamespace(namespace).

Type of Issue: improvement / refactor / duplicate code

✅ Expected Behavior

Each service calls the shared util.CheckForProjectNamespace helper instead of maintaining its own copy.

👎 Actual Behavior

ClusterService.checkForProjectNamespace, SliceConfigService.checkForProjectNamespace, and SliceQoSConfigService.checkForProjectNamespace each contain an identical method body. Any future change to the namespace label convention must be applied in four places.

✅ Proposed Solution

Remove the three private methods and replace each call site with util.CheckForProjectNamespace(namespace).

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find any similar issue

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions