Skip to content

Commit 057717b

Browse files
committed
move to annotations package
1 parent 3d0736a commit 057717b

File tree

23 files changed

+218
-199
lines changed

23 files changed

+218
-199
lines changed

api/v1alpha1/const.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,6 @@ const (
4242
LabelSharedDatabaseValueTrue = "true"
4343
LabelSharedDatabaseValueFalse = "false"
4444

45-
AnnotationUpdateStrategyOnDelete = "ydb.tech/update-strategy-on-delete"
46-
AnnotationUpdateDNSPolicy = "ydb.tech/update-dns-policy"
47-
AnnotationSkipInitialization = "ydb.tech/skip-initialization"
48-
AnnotationDisableLivenessProbe = "ydb.tech/disable-liveness-probe"
49-
AnnotationDataCenter = "ydb.tech/data-center"
50-
AnnotationGRPCPublicHost = "ydb.tech/grpc-public-host"
51-
AnnotationNodeHost = "ydb.tech/node-host"
52-
AnnotationNodeDomain = "ydb.tech/node-domain"
53-
54-
AnnotationValueTrue = "true"
55-
5645
legacyTenantNameFormat = "/%s/%s"
5746
)
5847

internal/annotations/annotations.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ package annotations
33
import "strings"
44

55
const (
6-
PrimaryResourceStorageAnnotation = "ydb.tech/primary-resource-storage"
7-
PrimaryResourceDatabaseAnnotation = "ydb.tech/primary-resource-database"
8-
RemoteResourceVersionAnnotation = "ydb.tech/remote-resource-version"
9-
ConfigurationChecksum = "ydb.tech/configuration-checksum"
10-
RemoteFinalizerKey = "ydb.tech/remote-finalizer"
11-
LastAppliedAnnotation = "ydb.tech/last-applied"
6+
ValueTrue = "true"
7+
8+
UpdateStrategyOnDelete = "ydb.tech/update-strategy-on-delete"
9+
UpdateDNSPolicy = "ydb.tech/update-dns-policy"
10+
SkipInitialization = "ydb.tech/skip-initialization"
11+
DisableLivenessProbe = "ydb.tech/disable-liveness-probe"
12+
DataCenter = "ydb.tech/data-center"
13+
GRPCPublicHost = "ydb.tech/grpc-public-host"
14+
NodeHost = "ydb.tech/node-host"
15+
NodeDomain = "ydb.tech/node-domain"
16+
17+
PrimaryResourceStorage = "ydb.tech/primary-resource-storage"
18+
PrimaryResourceDatabase = "ydb.tech/primary-resource-database"
19+
RemoteResourceVersion = "ydb.tech/remote-resource-version"
20+
ConfigurationChecksum = "ydb.tech/configuration-checksum"
21+
LastApplied = "ydb.tech/last-applied"
1222
)
1323

1424
func GetYdbTechAnnotations(annotations map[string]string) map[string]string {
@@ -21,17 +31,17 @@ func GetYdbTechAnnotations(annotations map[string]string) map[string]string {
2131
return result
2232
}
2333

24-
func GetLastAppliedAnnotation(annotations map[string]string) string {
34+
func getLastAppliedAnnotation(annotations map[string]string) string {
2535
for key, value := range annotations {
26-
if key == LastAppliedAnnotation {
36+
if key == LastApplied {
2737
return value
2838
}
2939
}
3040
return ""
3141
}
3242

3343
func CompareLastAppliedAnnotation(map1, map2 map[string]string) bool {
34-
value1 := GetLastAppliedAnnotation(map1)
35-
value2 := GetLastAppliedAnnotation(map2)
44+
value1 := getLastAppliedAnnotation(map1)
45+
value2 := getLastAppliedAnnotation(map2)
3646
return value1 == value2
3747
}

internal/controllers/constants/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@ const (
8787
DatabaseRefField = ".spec.databaseRef.name"
8888
StorageRefField = ".spec.storageRef.name"
8989
SecretField = ".spec.secrets"
90+
91+
RemoteFinalizerKey = "ydb.tech/remote-finalizer"
9092
)

internal/controllers/database/controller_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
2222
testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects"
23+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
2324
. "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants"
2425
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database"
2526
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage"
@@ -152,7 +153,7 @@ var _ = Describe("Database controller medium tests", func() {
152153
}, &foundDatabase)).Should(Succeed())
153154
nodeHost := fmt.Sprintf("%s.testing.k8s-c.yandex.net", testobjects.YdbNamespace)
154155
foundDatabase.Annotations = make(map[string]string)
155-
foundDatabase.Annotations[v1alpha1.AnnotationNodeHost] = nodeHost
156+
foundDatabase.Annotations[annotations.NodeHost] = nodeHost
156157
Eventually(func() error {
157158
return k8sClient.Update(ctx, &foundDatabase)
158159
}, test.Timeout, test.Interval).ShouldNot(HaveOccurred())
@@ -176,9 +177,9 @@ var _ = Describe("Database controller medium tests", func() {
176177
}, test.Timeout, test.Interval).ShouldNot(HaveOccurred())
177178

178179
podAnnotations := databaseStatefulSet.Spec.Template.Annotations
179-
val, exist := podAnnotations[v1alpha1.AnnotationNodeHost]
180+
val, exist := podAnnotations[annotations.NodeHost]
180181
if !exist {
181-
return fmt.Errorf("annotation %s does not exist on statefulset template", v1alpha1.AnnotationNodeHost)
182+
return fmt.Errorf("annotation %s does not exist on statefulset template", annotations.NodeHost)
182183
}
183184
if val != nodeHost {
184185
return fmt.Errorf("annotation value %s does not equal with desired: %s", val, nodeHost)

internal/controllers/database/init.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package database
33
import (
44
"context"
55
"fmt"
6+
"strconv"
67

78
corev1 "k8s.io/api/core/v1"
89
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -12,6 +13,7 @@ import (
1213
ctrl "sigs.k8s.io/controller-runtime"
1314

1415
"github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
16+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
1517
"github.com/ydb-platform/ydb-kubernetes-operator/internal/cms"
1618
. "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck
1719
"github.com/ydb-platform/ydb-kubernetes-operator/internal/resources"
@@ -33,15 +35,17 @@ func (r *Reconciler) setInitPipelineStatus(
3335
}
3436

3537
// This block is special internal logic that skips all Database initialization.
36-
if value, ok := database.Annotations[v1alpha1.AnnotationSkipInitialization]; ok && value == v1alpha1.AnnotationValueTrue {
37-
r.Log.Info("Database initialization disabled (with annotation), proceed with caution")
38-
r.Recorder.Event(
39-
database,
40-
corev1.EventTypeWarning,
41-
"SkippingInit",
42-
"Skipping initialization due to skip annotation present, be careful!",
43-
)
44-
return r.setInitDatabaseCompleted(ctx, database, "Database initialization not performed because initialization is skipped")
38+
if value, ok := database.Annotations[annotations.SkipInitialization]; ok {
39+
if isTrue, _ := strconv.ParseBool(value); isTrue {
40+
r.Log.Info("Database initialization disabled (with annotation), proceed with caution")
41+
r.Recorder.Event(
42+
database,
43+
corev1.EventTypeWarning,
44+
"SkippingInit",
45+
"Skipping initialization due to skip annotation present, be careful!",
46+
)
47+
return r.setInitDatabaseCompleted(ctx, database, "Database initialization not performed because initialization is skipped")
48+
}
4549
}
4650

4751
if meta.IsStatusConditionTrue(database.Status.Conditions, OldDatabaseInitializedCondition) {

internal/controllers/databasenodeset/controller_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
1919
testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects"
20+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
2021
. "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants"
2122
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database"
2223
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/databasenodeset"
@@ -151,7 +152,7 @@ var _ = Describe("DatabaseNodeSet controller medium tests", func() {
151152
}
152153

153154
foundDatabase.Annotations = map[string]string{
154-
v1alpha1.AnnotationUpdateStrategyOnDelete: "true",
155+
annotations.UpdateStrategyOnDelete: "true",
155156
}
156157

157158
foundDatabase.Spec.NodeSets = append(foundDatabase.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{
@@ -167,7 +168,7 @@ var _ = Describe("DatabaseNodeSet controller medium tests", func() {
167168
foundDatabase.Spec.NodeSets = append(foundDatabase.Spec.NodeSets, v1alpha1.DatabaseNodeSetSpecInline{
168169
Name: testNodeSetName + "-annotated",
169170
Annotations: map[string]string{
170-
v1alpha1.AnnotationDataCenter: "envtest",
171+
annotations.DataCenter: "envtest",
171172
},
172173
DatabaseNodeSpec: v1alpha1.DatabaseNodeSpec{
173174
Nodes: 2,
@@ -238,8 +239,8 @@ var _ = Describe("DatabaseNodeSet controller medium tests", func() {
238239
Name: databaseSample.Name + "-" + testNodeSetName + "-annotated",
239240
Namespace: testobjects.YdbNamespace,
240241
}, &annotatedDatabaseNodeSet)).Should(Succeed())
241-
Expect(annotatedDatabaseNodeSet.Annotations[v1alpha1.AnnotationUpdateStrategyOnDelete]).Should(Equal("true"))
242-
Expect(annotatedDatabaseNodeSet.Annotations[v1alpha1.AnnotationDataCenter]).Should(Equal("envtest"))
242+
Expect(annotatedDatabaseNodeSet.Annotations[annotations.UpdateStrategyOnDelete]).Should(Equal("true"))
243+
Expect(annotatedDatabaseNodeSet.Annotations[annotations.DataCenter]).Should(Equal("envtest"))
243244

244245
annotatedDatabaseStatefulSet := appsv1.StatefulSet{}
245246
Expect(k8sClient.Get(ctx, types.NamespacedName{

internal/controllers/remotedatabasenodeset/controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
7272
// The object is not being deleted, so if it does not have our finalizer,
7373
// then lets add the finalizer and update the object. This is equivalent
7474
// to registering our finalizer.
75-
if !controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) {
76-
controllerutil.AddFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey)
75+
if !controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, RemoteFinalizerKey) {
76+
controllerutil.AddFinalizer(remoteDatabaseNodeSet, RemoteFinalizerKey)
7777
if err := r.RemoteClient.Update(ctx, remoteDatabaseNodeSet); err != nil {
7878
return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err
7979
}
8080
}
8181
} else {
8282
// The object is being deleted
83-
if controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey) {
83+
if controllerutil.ContainsFinalizer(remoteDatabaseNodeSet, RemoteFinalizerKey) {
8484
// our finalizer is present, so lets handle any external dependency
8585
if err := r.deleteExternalResources(ctx, remoteDatabaseNodeSet); err != nil {
8686
// if fail to delete the external dependency here, return with error
@@ -89,7 +89,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
8989
}
9090

9191
// remove our finalizer from the list and update it.
92-
controllerutil.RemoveFinalizer(remoteDatabaseNodeSet, ydbannotations.RemoteFinalizerKey)
92+
controllerutil.RemoveFinalizer(remoteDatabaseNodeSet, RemoteFinalizerKey)
9393
if err := r.RemoteClient.Update(ctx, remoteDatabaseNodeSet); err != nil {
9494
return ctrl.Result{RequeueAfter: DefaultRequeueDelay}, err
9595
}
@@ -119,7 +119,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, remoteCluster *cluster.C
119119
requests := make([]reconcile.Request, 0)
120120

121121
annotations := mapObj.GetAnnotations()
122-
primaryResourceName, exist := annotations[ydbannotations.PrimaryResourceDatabaseAnnotation]
122+
primaryResourceName, exist := annotations[ydbannotations.PrimaryResourceDatabase]
123123
if exist {
124124
databaseNodeSets := &v1alpha1.DatabaseNodeSetList{}
125125
if err := r.Client.List(

internal/controllers/remotedatabasenodeset/controller_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
"github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
3131
testobjects "github.com/ydb-platform/ydb-kubernetes-operator/e2e/tests/test-objects"
32-
ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
32+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
3333
. "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants"
3434
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/database"
3535
"github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/databasenodeset"
@@ -530,25 +530,25 @@ var _ = Describe("RemoteDatabaseNodeSet controller tests", func() {
530530
return err
531531
}
532532

533-
primaryResourceStorage, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceStorageAnnotation]
533+
primaryResourceStorage, exist := remoteSecret.Annotations[annotations.PrimaryResourceStorage]
534534
if !exist {
535-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceStorageAnnotation, remoteSecret.Name)
535+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.PrimaryResourceStorage, remoteSecret.Name)
536536
}
537537
if primaryResourceStorage != foundRemoteStorageNodeSet.Spec.StorageRef.Name {
538538
return fmt.Errorf("primaryResourceName %s does not equal storageRef name %s", primaryResourceStorage, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name)
539539
}
540540

541-
primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation]
541+
primaryResourceDatabase, exist := remoteSecret.Annotations[annotations.PrimaryResourceDatabase]
542542
if !exist {
543-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name)
543+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.PrimaryResourceDatabase, remoteSecret.Name)
544544
}
545545
if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name {
546546
return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name)
547547
}
548548

549-
remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation]
549+
remoteRV, exist := remoteSecret.Annotations[annotations.RemoteResourceVersion]
550550
if !exist {
551-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name)
551+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.RemoteResourceVersion, remoteSecret.Name)
552552
}
553553
if localSecret.GetResourceVersion() != remoteRV {
554554
return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV)
@@ -621,22 +621,22 @@ var _ = Describe("RemoteDatabaseNodeSet controller tests", func() {
621621
return err
622622
}
623623

624-
_, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceStorageAnnotation]
624+
_, exist := remoteSecret.Annotations[annotations.PrimaryResourceStorage]
625625
if exist {
626-
return fmt.Errorf("annotation %s still exist on remoteSecret %s", ydbannotations.PrimaryResourceStorageAnnotation, remoteSecret.Name)
626+
return fmt.Errorf("annotation %s still exist on remoteSecret %s", annotations.PrimaryResourceStorage, remoteSecret.Name)
627627
}
628628

629-
primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation]
629+
primaryResourceDatabase, exist := remoteSecret.Annotations[annotations.PrimaryResourceDatabase]
630630
if !exist {
631-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name)
631+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.PrimaryResourceDatabase, remoteSecret.Name)
632632
}
633633
if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name {
634634
return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name)
635635
}
636636

637-
remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation]
637+
remoteRV, exist := remoteSecret.Annotations[annotations.RemoteResourceVersion]
638638
if !exist {
639-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name)
639+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.RemoteResourceVersion, remoteSecret.Name)
640640
}
641641
if localSecret.GetResourceVersion() != remoteRV {
642642
return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV)
@@ -687,17 +687,17 @@ var _ = Describe("RemoteDatabaseNodeSet controller tests", func() {
687687
return err
688688
}
689689

690-
primaryResourceDatabase, exist := remoteSecret.Annotations[ydbannotations.PrimaryResourceDatabaseAnnotation]
690+
primaryResourceDatabase, exist := remoteSecret.Annotations[annotations.PrimaryResourceDatabase]
691691
if !exist {
692-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.PrimaryResourceDatabaseAnnotation, remoteSecret.Name)
692+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.PrimaryResourceDatabase, remoteSecret.Name)
693693
}
694694
if primaryResourceDatabase != foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name {
695695
return fmt.Errorf("primaryResourceName %s does not equal databaseRef name %s", primaryResourceDatabase, foundRemoteDatabaseNodeSet.Spec.DatabaseRef.Name)
696696
}
697697

698-
remoteRV, exist := remoteSecret.Annotations[ydbannotations.RemoteResourceVersionAnnotation]
698+
remoteRV, exist := remoteSecret.Annotations[annotations.RemoteResourceVersion]
699699
if !exist {
700-
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", ydbannotations.RemoteResourceVersionAnnotation, remoteSecret.Name)
700+
return fmt.Errorf("annotation %s does not exist on remoteSecret %s", annotations.RemoteResourceVersion, remoteSecret.Name)
701701
}
702702
if localSecret.GetResourceVersion() != remoteRV {
703703
return fmt.Errorf("localRV %s does not equal remoteRV %s", localSecret.GetResourceVersion(), remoteRV)

internal/controllers/remotedatabasenodeset/remote_objects.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import (
99
apierrors "k8s.io/apimachinery/pkg/api/errors"
1010
"k8s.io/apimachinery/pkg/api/meta"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12-
"k8s.io/apimachinery/pkg/labels"
12+
apilabels "k8s.io/apimachinery/pkg/labels"
1313
"k8s.io/apimachinery/pkg/selection"
1414
"k8s.io/apimachinery/pkg/types"
1515
ctrl "sigs.k8s.io/controller-runtime"
1616
"sigs.k8s.io/controller-runtime/pkg/client"
1717

1818
"github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
19-
ydbannotations "github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
19+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
2020
. "github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/constants" //nolint:revive,stylecheck
21-
ydblabels "github.com/ydb-platform/ydb-kubernetes-operator/internal/labels"
21+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/labels"
2222
"github.com/ydb-platform/ydb-kubernetes-operator/internal/resources"
2323
)
2424

@@ -278,7 +278,7 @@ func (r *Reconciler) removeUnusedRemoteObjects(
278278
// Remove annotation if no one another DatabaseNodeSet
279279
if !existInDatabase {
280280
// Try to update existing object in local cluster by rawPatch
281-
patch := []byte(fmt.Sprintf(`{"metadata": {"annotations": {"%s": null}}}`, ydbannotations.PrimaryResourceStorageAnnotation))
281+
patch := []byte(fmt.Sprintf(`{"metadata": {"annotations": {"%s": null}}}`, annotations.PrimaryResourceStorage))
282282
updateErr := r.Client.Patch(ctx, localObj, client.RawPatch(types.StrategicMergePatchType, patch))
283283
if updateErr != nil {
284284
r.Recorder.Event(
@@ -298,7 +298,7 @@ func (r *Reconciler) removeUnusedRemoteObjects(
298298
}
299299

300300
// Delete resource if annotation `ydb.tech/primary-resource-storage` does not exist
301-
_, existInStorage := localObj.GetAnnotations()[ydbannotations.PrimaryResourceStorageAnnotation]
301+
_, existInStorage := localObj.GetAnnotations()[annotations.PrimaryResourceStorage]
302302
if !existInStorage {
303303
// Try to delete unused resource from local cluster
304304
deleteErr := r.Client.Delete(ctx, localObj)
@@ -392,10 +392,10 @@ func (r *Reconciler) getAnotherDatabaseNodeSets(
392392
) ([]v1alpha1.DatabaseNodeSet, error) {
393393
// Create label requirement that label `ydb.tech/database-nodeset` which not equal
394394
// to current DatabaseNodeSet object for exclude current nodeSet from List result
395-
labelRequirement, err := labels.NewRequirement(
396-
ydblabels.DatabaseNodeSetComponent,
395+
labelRequirement, err := apilabels.NewRequirement(
396+
labels.DatabaseNodeSetComponent,
397397
selection.NotEquals,
398-
[]string{remoteDatabaseNodeSet.Labels[ydblabels.DatabaseNodeSetComponent]},
398+
[]string{remoteDatabaseNodeSet.Labels[labels.DatabaseNodeSetComponent]},
399399
)
400400
if err != nil {
401401
return nil, err
@@ -409,7 +409,7 @@ func (r *Reconciler) getAnotherDatabaseNodeSets(
409409
&databaseNodeSets,
410410
client.InNamespace(remoteDatabaseNodeSet.Namespace),
411411
client.MatchingLabelsSelector{
412-
Selector: labels.NewSelector().Add(*labelRequirement),
412+
Selector: apilabels.NewSelector().Add(*labelRequirement),
413413
},
414414
client.MatchingFields{
415415
DatabaseRefField: remoteDatabaseNodeSet.Spec.DatabaseRef.Name,

0 commit comments

Comments
 (0)