Skip to content

Commit 3d0736a

Browse files
committed
fixes pointers
1 parent e50c1ad commit 3d0736a

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

internal/annotations/annotations.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const (
88
RemoteResourceVersionAnnotation = "ydb.tech/remote-resource-version"
99
ConfigurationChecksum = "ydb.tech/configuration-checksum"
1010
RemoteFinalizerKey = "ydb.tech/remote-finalizer"
11-
LastApplied = "ydb.tech/last-applied"
11+
LastAppliedAnnotation = "ydb.tech/last-applied"
1212
)
1313

1414
func GetYdbTechAnnotations(annotations map[string]string) map[string]string {
@@ -23,7 +23,7 @@ func GetYdbTechAnnotations(annotations map[string]string) map[string]string {
2323

2424
func GetLastAppliedAnnotation(annotations map[string]string) string {
2525
for key, value := range annotations {
26-
if key == LastApplied {
26+
if key == LastAppliedAnnotation {
2727
return value
2828
}
2929
}

internal/controllers/storage/controller_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ var _ = Describe("Storage controller medium tests", func() {
126126
foundConfigurationChecksumAnnotation = true
127127
}
128128
Expect(foundConfigurationChecksumAnnotation).To(BeTrue())
129+
130+
_, exist := podAnnotations[annotations.LastAppliedAnnotation]
131+
Expect(exist).To(BeFalse())
129132
})
130133

131134
By("Check that args with --label propagated to pods...", func() {

internal/resources/database.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (b *DatabaseBuilder) NewAnnotations() map[string]string {
4646
an[k] = v
4747
}
4848
an[annotations.ConfigurationChecksum] = GetSHA256Checksum(b.Spec.Configuration)
49-
delete(an, annotations.LastApplied)
49+
delete(an, annotations.LastAppliedAnnotation)
5050
return an
5151
}
5252

internal/resources/resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type ResourceBuilder interface {
8585
}
8686

8787
var (
88-
annotator = patch.NewAnnotator(ydbannotations.LastApplied)
88+
annotator = patch.NewAnnotator(ydbannotations.LastAppliedAnnotation)
8989
patchMaker = patch.NewPatchMaker(annotator)
9090
)
9191

internal/resources/storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (b *StorageClusterBuilder) NewAnnotations() map[string]string {
4646
an[k] = v
4747
}
4848
an[annotations.ConfigurationChecksum] = GetSHA256Checksum(b.Spec.Configuration)
49-
delete(an, annotations.LastApplied)
49+
delete(an, annotations.LastAppliedAnnotation)
5050
return an
5151
}
5252

internal/resources/storage_statefulset.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (b *StorageStatefulSetBuilder) Build(obj client.Object) error {
6969
sts.Spec = appsv1.StatefulSetSpec{
7070
Replicas: replicas,
7171
Selector: &metav1.LabelSelector{
72-
MatchLabels: b.Labels,
72+
MatchLabels: CopyDict(b.Labels),
7373
},
7474
PodManagementPolicy: appsv1.ParallelPodManagement,
7575
RevisionHistoryLimit: ptr.Int32(10),
@@ -107,8 +107,8 @@ func (b *StorageStatefulSetBuilder) buildPodTemplateSpec() corev1.PodTemplateSpe
107107

108108
podTemplate := corev1.PodTemplateSpec{
109109
ObjectMeta: metav1.ObjectMeta{
110-
Labels: b.Labels,
111-
Annotations: b.Annotations,
110+
Labels: CopyDict(b.Labels),
111+
Annotations: CopyDict(b.Annotations),
112112
},
113113
Spec: corev1.PodSpec{
114114
Containers: []corev1.Container{b.buildContainer()},

0 commit comments

Comments
 (0)