@@ -29,23 +29,14 @@ func NewDatabase(ydbCr *api.Database) DatabaseBuilder {
2929
3030func (b * DatabaseBuilder ) NewLabels () labels.Labels {
3131 l := labels .Common (b .Name , b .Labels )
32-
33- l .Merge (b .Spec .AdditionalLabels )
3432 l .Merge (map [string ]string {labels .ComponentKey : labels .DynamicComponent })
3533
3634 return l
3735}
3836
39- func (b * DatabaseBuilder ) NewAnnotations () map [ string ] string {
37+ func (b * DatabaseBuilder ) NewAnnotations () annotations. Annotations {
4038 an := annotations .Common (b .Annotations )
4139
42- an .Merge (b .Spec .AdditionalAnnotations )
43- if b .Spec .Configuration != "" {
44- an .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Spec .Configuration )})
45- } else {
46- an .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Storage .Spec .Configuration )})
47- }
48-
4940 return an
5041}
5142
@@ -62,8 +53,17 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc
6253 databaseAnnotations := b .NewAnnotations ()
6354
6455 statefulSetLabels := databaseLabels .Copy ()
56+ statefulSetLabels .Merge (b .Spec .AdditionalLabels )
6557 statefulSetLabels .Merge (map [string ]string {labels .StatefulsetComponent : b .Name })
6658
59+ statefulSetAnnotations := databaseAnnotations .Copy ()
60+ statefulSetAnnotations .Merge (b .Spec .AdditionalAnnotations )
61+ if b .Spec .Configuration != "" {
62+ statefulSetAnnotations .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Spec .Configuration )})
63+ } else {
64+ statefulSetAnnotations .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Storage .Spec .Configuration )})
65+ }
66+
6767 grpcServiceLabels := databaseLabels .Copy ()
6868 grpcServiceLabels .Merge (b .Spec .Service .GRPC .AdditionalLabels )
6969 grpcServiceLabels .Merge (map [string ]string {labels .ServiceComponent : labels .GRPCComponent })
@@ -205,7 +205,7 @@ func (b *DatabaseBuilder) GetResourceBuilders(restConfig *rest.Config) []Resourc
205205
206206 Name : b .Name ,
207207 Labels : statefulSetLabels ,
208- Annotations : databaseAnnotations ,
208+ Annotations : statefulSetAnnotations ,
209209 },
210210 )
211211 } else {
@@ -235,6 +235,11 @@ func (b *DatabaseBuilder) getNodeSetBuilders(
235235
236236 nodeSetAnnotations := databaseAnnotations .Copy ()
237237 nodeSetAnnotations .Merge (nodeSetSpecInline .Annotations )
238+ if b .Spec .Configuration != "" {
239+ nodeSetAnnotations .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Spec .Configuration )})
240+ } else {
241+ nodeSetAnnotations .Merge (map [string ]string {annotations .ConfigurationChecksum : GetSHA256Checksum (b .Storage .Spec .Configuration )})
242+ }
238243
239244 databaseNodeSetSpec := b .recastDatabaseNodeSetSpecInline (nodeSetSpecInline .DeepCopy ())
240245 if nodeSetSpecInline .Remote != nil {
0 commit comments