From c0cc5b4e82f35fcdb093bcf85064520f51defc97 Mon Sep 17 00:00:00 2001 From: Alexey Kazakov Date: Wed, 3 Jul 2024 18:50:04 -0700 Subject: [PATCH] linter --- controllers/nstemplateset/cluster_resources_test.go | 4 ++-- controllers/nstemplateset/namespaces.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/nstemplateset/cluster_resources_test.go b/controllers/nstemplateset/cluster_resources_test.go index c1af85ec..157e5ad9 100644 --- a/controllers/nstemplateset/cluster_resources_test.go +++ b/controllers/nstemplateset/cluster_resources_test.go @@ -550,8 +550,8 @@ func TestDeleteClusterResources(t *testing.T) { withNamespaces("abcde11", "dev", "code"), withDeletionTs(), withClusterResources("abcde11"), - withNSTemplateSetFeatureAnnotation("feature-1")) - crq := newClusterResourceQuota(spacename, "advanced", withFeatureAnnotation("feature-1")) + withNSTemplateSetFeatureAnnotation("feature-2")) + crq := newClusterResourceQuota(spacename, "advanced", withFeatureAnnotation("feature-2"), withName("feature-2-for-"+spacename)) manager, cl := prepareClusterResourcesManager(t, nsTmplSet, crq) diff --git a/controllers/nstemplateset/namespaces.go b/controllers/nstemplateset/namespaces.go index 44929b83..fd877f75 100644 --- a/controllers/nstemplateset/namespaces.go +++ b/controllers/nstemplateset/namespaces.go @@ -196,12 +196,12 @@ func (r *namespacesManager) ensureInnerNamespaceResources(ctx context.Context, n currentRef, exists := namespace.Labels[toolchainv1alpha1.TemplateRefLabelKey] if exists { // Now check if there is any featured object to be deleted in case the feature annotation does not present in the NSTemplateSet anymore - featureStr, _ := nsTmplSet.Annotations[toolchainv1alpha1.FeatureToggleNameAnnotationKey] - features := strings.Split(featureStr, ",") toDeleteObsoleteFeaturedObjects := false + featureStr := nsTmplSet.Annotations[toolchainv1alpha1.FeatureToggleNameAnnotationKey] + features := strings.Split(featureStr, ",") for _, obj := range newObjs { - objFeature, found := obj.GetAnnotations()[toolchainv1alpha1.FeatureToggleNameAnnotationKey] - if found && !slices.Contains(features, objFeature) { + objFeature, f := obj.GetAnnotations()[toolchainv1alpha1.FeatureToggleNameAnnotationKey] + if f && !slices.Contains(features, objFeature) { // This object represents a disabled feature. We need to delete obsolete objects. toDeleteObsoleteFeaturedObjects = true break