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?
Code of Conduct
Problem:
Three service structs each define an identical private method
checkForProjectNamespace(*corev1.Namespace) boolthat does exactly the same check as the publicutil.CheckForProjectNamespacefunction that already exists inutil/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 theutil.ProjectKindconstant.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.CheckForProjectNamespacehelper instead of maintaining its own copy.👎 Actual Behavior
ClusterService.checkForProjectNamespace,SliceConfigService.checkForProjectNamespace, andSliceQoSConfigService.checkForProjectNamespaceeach 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?
Code of Conduct