Skip to content

Commit 2c61b5a

Browse files
committed
update based on reviews
1 parent 8f6d3d0 commit 2c61b5a

File tree

2 files changed

+117
-233
lines changed

2 files changed

+117
-233
lines changed

internal/controller/provisioner/setter.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,14 @@ func objectSpecSetter(object client.Object) controllerutil.MutateFn {
4040
return nil
4141
}
4242

43-
const (
44-
managedKeysAnnotation = "gateway.nginx.org/internal-managed-annotation-keys"
45-
)
46-
4743
func deploymentSpecSetter(
4844
deployment *appsv1.Deployment,
4945
spec appsv1.DeploymentSpec,
5046
objectMeta metav1.ObjectMeta,
5147
) controllerutil.MutateFn {
5248
return func() error {
5349
deployment.Labels = objectMeta.Labels
54-
deployment.Annotations = mergeAnnotations(deployment.Annotations, objectMeta.Annotations, managedKeysAnnotation)
50+
deployment.Annotations = mergeAnnotations(deployment.Annotations, objectMeta.Annotations)
5551
deployment.Spec = spec
5652
return nil
5753
}
@@ -77,7 +73,7 @@ func daemonSetSpecSetter(
7773
) controllerutil.MutateFn {
7874
return func() error {
7975
daemonSet.Labels = objectMeta.Labels
80-
daemonSet.Annotations = mergeAnnotations(daemonSet.Annotations, objectMeta.Annotations, managedKeysAnnotation)
76+
daemonSet.Annotations = mergeAnnotations(daemonSet.Annotations, objectMeta.Annotations)
8177
daemonSet.Spec = spec
8278
return nil
8379
}
@@ -90,7 +86,7 @@ func serviceSpecSetter(
9086
) controllerutil.MutateFn {
9187
return func() error {
9288
service.Labels = objectMeta.Labels
93-
service.Annotations = mergeAnnotations(service.Annotations, objectMeta.Annotations, managedKeysAnnotation)
89+
service.Annotations = mergeAnnotations(service.Annotations, objectMeta.Annotations)
9490
service.Spec = spec
9591
return nil
9692
}
@@ -169,7 +165,8 @@ func roleBindingSpecSetter(
169165
}
170166
}
171167

172-
func mergeAnnotations(existing, desired map[string]string, trackingKey string) map[string]string {
168+
func mergeAnnotations(existing, desired map[string]string) map[string]string {
169+
trackingKey := "gateway.nginx.org/internal-managed-annotation-keys"
173170
desiredKeys := make(map[string]struct{}, len(desired))
174171
for key := range desired {
175172
desiredKeys[key] = struct{}{}

0 commit comments

Comments
 (0)