diff --git a/bundle/manifests/lvms-operator.clusterserviceversion.yaml b/bundle/manifests/lvms-operator.clusterserviceversion.yaml index c0ef94cd1..7f4783476 100644 --- a/bundle/manifests/lvms-operator.clusterserviceversion.yaml +++ b/bundle/manifests/lvms-operator.clusterserviceversion.yaml @@ -66,7 +66,6 @@ metadata: "lvmvolumegroups.lvm.topolvm.io", "lvmvolumegroupnodestatuses.lvm.topolvm.io"]' operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/openshift/lvm-operator - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' labels: operatorframework.io/arch.amd64: supported operatorframework.io/arch.arm64: supported diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml index df18837ec..6c400155c 100644 --- a/config/default/manager_config_patch.yaml +++ b/config/default/manager_config_patch.yaml @@ -3,8 +3,6 @@ kind: Deployment metadata: name: controller-manager namespace: system - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' spec: template: spec: diff --git a/config/default/manager_custom_env.yaml b/config/default/manager_custom_env.yaml index 66ee86d2d..3992a076a 100644 --- a/config/default/manager_custom_env.yaml +++ b/config/default/manager_custom_env.yaml @@ -3,8 +3,6 @@ kind: Deployment metadata: name: operator namespace: system - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' spec: template: spec: diff --git a/config/default/manager_custom_env.yaml.in b/config/default/manager_custom_env.yaml.in index 4a016bc5f..69ada8551 100644 --- a/config/default/manager_custom_env.yaml.in +++ b/config/default/manager_custom_env.yaml.in @@ -3,8 +3,6 @@ kind: Deployment metadata: name: operator namespace: system - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' spec: template: spec: diff --git a/config/default/manager_webhook_patch.yaml b/config/default/manager_webhook_patch.yaml index e965ad71a..9d7eb3fb9 100644 --- a/config/default/manager_webhook_patch.yaml +++ b/config/default/manager_webhook_patch.yaml @@ -3,8 +3,6 @@ kind: Deployment metadata: name: operator namespace: system - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' spec: template: spec: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 13360dc51..2ff5f01b7 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -17,8 +17,6 @@ kind: Deployment metadata: name: operator namespace: system - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' labels: app.kubernetes.io/name: lvms-operator spec: diff --git a/config/manifests/bases/clusterserviceversion.yaml.in b/config/manifests/bases/clusterserviceversion.yaml.in index 952c9292a..2c98072f2 100644 --- a/config/manifests/bases/clusterserviceversion.yaml.in +++ b/config/manifests/bases/clusterserviceversion.yaml.in @@ -35,7 +35,6 @@ metadata: operators.openshift.io/infrastructure-features: '["csi", "disconnected"]' operators.openshift.io/valid-subscription: '["OpenShift Container Platform", "OpenShift Platform Plus"]' operators.operatorframework.io/internal-objects: '["logicalvolumes.topolvm.io", "lvmvolumegroups.lvm.topolvm.io", "lvmvolumegroupnodestatuses.lvm.topolvm.io"]' - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' labels: operatorframework.io/arch.amd64: supported operatorframework.io/arch.arm64: supported diff --git a/config/manifests/bases/lvms-operator.clusterserviceversion.yaml b/config/manifests/bases/lvms-operator.clusterserviceversion.yaml index f483959e2..f7c7236dd 100644 --- a/config/manifests/bases/lvms-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/lvms-operator.clusterserviceversion.yaml @@ -35,7 +35,6 @@ metadata: operators.openshift.io/infrastructure-features: '["csi", "disconnected"]' operators.openshift.io/valid-subscription: '["OpenShift Container Platform", "OpenShift Platform Plus"]' operators.operatorframework.io/internal-objects: '["logicalvolumes.topolvm.io", "lvmvolumegroups.lvm.topolvm.io", "lvmvolumegroupnodestatuses.lvm.topolvm.io"]' - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' labels: operatorframework.io/arch.amd64: supported operatorframework.io/arch.arm64: supported diff --git a/controllers/topolvm_node.go b/controllers/topolvm_node.go index 1291740f2..f67f0ea01 100644 --- a/controllers/topolvm_node.go +++ b/controllers/topolvm_node.go @@ -94,6 +94,11 @@ func (n topolvmNode) ensureCreated(r *LVMClusterReconciler, ctx context.Context, ds.ObjectMeta.Annotations[key] = value } + initMapIfNil(&ds.Spec.Template.Annotations) + for key, value := range dsTemplate.Spec.Template.Annotations { + ds.Spec.Template.Annotations[key] = value + } + return nil }) @@ -193,10 +198,9 @@ func getNodeDaemonSet(lvmCluster *lvmv1alpha1.LVMCluster, namespace string, init } nodeDaemonSet := &appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ - Name: TopolvmNodeDaemonsetName, - Namespace: namespace, - Annotations: annotations, - Labels: labels, + Name: TopolvmNodeDaemonsetName, + Namespace: namespace, + Labels: labels, }, Spec: appsv1.DaemonSetSpec{ Selector: &metav1.LabelSelector{MatchLabels: labels}, @@ -205,8 +209,9 @@ func getNodeDaemonSet(lvmCluster *lvmv1alpha1.LVMCluster, namespace string, init }, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Name: lvmCluster.Name, - Labels: labels, + Name: lvmCluster.Name, + Annotations: annotations, + Labels: labels, }, Spec: corev1.PodSpec{ ServiceAccountName: TopolvmNodeServiceAccount, diff --git a/controllers/vgmanager.go b/controllers/vgmanager.go index 35d577650..06bb9325c 100644 --- a/controllers/vgmanager.go +++ b/controllers/vgmanager.go @@ -82,6 +82,11 @@ func (v vgManager) ensureCreated(r *LVMClusterReconciler, ctx context.Context, l ds.ObjectMeta.Annotations[key] = value } + initMapIfNil(&ds.Spec.Template.Annotations) + for key, value := range dsTemplate.Spec.Template.Annotations { + ds.Spec.Template.Annotations[key] = value + } + // containers ds.Spec.Template.Spec.Containers = dsTemplate.Spec.Template.Spec.Containers diff --git a/controllers/vgmanager_daemonset.go b/controllers/vgmanager_daemonset.go index e14253867..0fa12406c 100644 --- a/controllers/vgmanager_daemonset.go +++ b/controllers/vgmanager_daemonset.go @@ -181,16 +181,16 @@ func newVGManagerDaemonset(lvmCluster *lvmv1alpha1.LVMCluster, namespace string, } ds := appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ - Name: VGManagerUnit, - Namespace: namespace, - Annotations: annotations, - Labels: labels, + Name: VGManagerUnit, + Namespace: namespace, + Labels: labels, }, Spec: appsv1.DaemonSetSpec{ Selector: &metav1.LabelSelector{MatchLabels: labels}, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: labels, + Annotations: annotations, + Labels: labels, }, Spec: corev1.PodSpec{