Skip to content

Commit 58ddbb4

Browse files
committed
fix init job labels
1 parent 801c3d4 commit 58ddbb4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

internal/resources/storage_init_job.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sigs.k8s.io/controller-runtime/pkg/client"
1111

1212
api "github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1"
13-
"github.com/ydb-platform/ydb-kubernetes-operator/internal/annotations"
13+
"github.com/ydb-platform/ydb-kubernetes-operator/internal/labels"
1414
"github.com/ydb-platform/ydb-kubernetes-operator/internal/ptr"
1515
)
1616

@@ -58,16 +58,20 @@ func (b *StorageInitJobBuilder) Placeholder(cr client.Object) client.Object {
5858

5959
func GetInitJobBuilder(storage *api.Storage) ResourceBuilder {
6060
jobName := fmt.Sprintf(InitJobNameFormat, storage.Name)
61-
jobLabels := StorageLabels(storage)
62-
jobAnnotations := annotations.GetYdbTechAnnotations(storage.Annotations)
63-
delete(jobAnnotations, annotations.LastAppliedAnnotation)
61+
jobLabels := labels.Common(storage.Name, labels.Labels{})
62+
jobLabels.Merge(storage.Spec.AdditionalLabels)
63+
jobAnnotations := CopyDict(storage.Spec.AdditionalAnnotations)
6464

6565
if storage.Spec.InitJob != nil {
6666
if storage.Spec.InitJob.AdditionalLabels != nil {
67-
jobLabels.Merge(storage.Spec.InitJob.AdditionalLabels)
67+
for k, v := range storage.Spec.InitJob.AdditionalLabels {
68+
jobLabels[k] = v
69+
}
6870
}
6971
if storage.Spec.InitJob.AdditionalAnnotations != nil {
70-
jobAnnotations = CopyDict(storage.Spec.InitJob.AdditionalAnnotations)
72+
for k, v := range storage.Spec.InitJob.AdditionalAnnotations {
73+
jobAnnotations[k] = v
74+
}
7175
}
7276
}
7377

0 commit comments

Comments
 (0)