helm: apply operator settings in configmap instead of deployment

Some operator settings can be applied dynamically in a configmap
instead of requiring the operator to restart. While these settings
may be infrequently updated, applying these settings in the configmap
can avoid an unnecessary operator restart. This will also make the
operator deployment more consistent with the non-helm install.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
(cherry picked from commit 741f211a13)
This commit is contained in:
Travis Nielsen authored and mergify-bot committed 2022-01-20 22:38:33 +00:00
1 parent 8957be1adf
commit 7470e51d5b
4 files changed
+163 -230

No files matched your search

@@ -0,0 +1,163 @@
# Operator settings that can be updated without an operator restart
# Operator settings that require an operator restart are found in the operator env vars
kind: ConfigMap
apiVersion: v1
metadata:
name: rook-ceph-operator-config
data:
ROOK_LOG_LEVEL: {{ .Values.logLevel | quote }}
ROOK_CEPH_COMMANDS_TIMEOUT_SECONDS: {{ .Values.cephCommandsTimeoutSeconds | quote }}
ROOK_OBC_WATCH_OPERATOR_NAMESPACE: {{ .Values.enableOBCWatchOperatorNamespace | quote }}
{{- if .Values.csi }}
ROOK_CSI_ENABLE_RBD: {{ .Values.csi.enableRbdDriver | quote }}
ROOK_CSI_ENABLE_CEPHFS: {{ .Values.csi.enableCephfsDriver | quote }}
CSI_ENABLE_CEPHFS_SNAPSHOTTER: {{ .Values.csi.enableCephfsSnapshotter | quote }}
CSI_ENABLE_RBD_SNAPSHOTTER: {{ .Values.csi.enableRBDSnapshotter | quote }}
CSI_PLUGIN_ENABLE_SELINUX_HOST_MOUNT: {{ .Values.csi.enablePluginSelinuxHostMount | quote }}
CSI_ENABLE_OMAP_GENERATOR: {{ .Values.csi.enableOMAPGenerator | quote }}
{{- if .Values.csi.pluginPriorityClassName }}
CSI_PLUGIN_PRIORITY_CLASSNAME: {{ .Values.csi.pluginPriorityClassName | quote }}
{{- end }}
{{- if .Values.csi.provisionerPriorityClassName }}
CSI_PROVISIONER_PRIORITY_CLASSNAME: {{ .Values.csi.provisionerPriorityClassName | quote }}
{{- end }}
{{- if .Values.csi.enableCSIHostNetwork }}
CSI_ENABLE_HOST_NETWORK: {{ .Values.csi.enableCSIHostNetwork | quote }}
{{- end }}
{{- if .Values.csi.cephFSPluginUpdateStrategy }}
CSI_CEPHFS_PLUGIN_UPDATE_STRATEGY: {{ .Values.csi.cephFSPluginUpdateStrategy | quote }}
{{- end }}
{{- if .Values.csi.rbdFSGroupPolicy }}
CSI_RBD_FSGROUPPOLICY: {{ .Values.csi.rbdFSGroupPolicy | quote }}
{{- end }}
{{- if .Values.csi.cephFSFSGroupPolicy }}
CSI_CEPHFS_FSGROUPPOLICY: {{ .Values.csi.cephFSFSGroupPolicy | quote }}
{{- end }}
{{- if .Values.csi.rbdPluginUpdateStrategy }}
CSI_RBD_PLUGIN_UPDATE_STRATEGY: {{ .Values.csi.rbdPluginUpdateStrategy | quote }}
{{- end }}
{{- if .Values.csi.kubeletDirPath }}
ROOK_CSI_KUBELET_DIR_PATH: {{ .Values.csi.kubeletDirPath | quote }}
{{- end }}
ROOK_CSI_ENABLE_GRPC_METRICS: {{ .Values.csi.enableGrpcMetrics | quote }}
{{- if .Values.csi.cephcsi }}
{{- if .Values.csi.cephcsi.image }}
ROOK_CSI_CEPH_IMAGE: {{ .Values.csi.cephcsi.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.registrar }}
{{- if .Values.csi.registrar.image }}
ROOK_CSI_REGISTRAR_IMAGE: {{ .Values.csi.registrar.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.provisioner }}
{{- if .Values.csi.provisioner.image }}
ROOK_CSI_PROVISIONER_IMAGE: {{ .Values.csi.provisioner.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.snapshotter }}
{{- if .Values.csi.snapshotter.image }}
ROOK_CSI_SNAPSHOTTER_IMAGE: {{ .Values.csi.snapshotter.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.attacher }}
{{- if .Values.csi.attacher.image }}
ROOK_CSI_ATTACHER_IMAGE: {{ .Values.csi.attacher.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.resizer }}
{{- if .Values.csi.resizer.image }}
ROOK_CSI_RESIZER_IMAGE: {{ .Values.csi.resizer.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.volumeReplication }}
CSI_ENABLE_VOLUME_REPLICATION: {{ .Values.csi.volumeReplication.enabled | quote }}
{{- if .Values.csi.volumeReplication.image }}
CSI_VOLUME_REPLICATION_IMAGE: {{ .Values.csi.volumeReplication.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.csiAddons }}
CSI_ENABLE_CSIADDONS: {{ .Values.csi.csiAddons.enabled | quote }}
{{- if .Values.csi.csiAddons.image }}
ROOK_CSIADDONS_IMAGE: {{ .Values.csi.csiAddons.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.cephfsPodLabels }}
ROOK_CSI_CEPHFS_POD_LABELS: {{ .Values.csi.cephfsPodLabels | quote }}
{{- end }}
{{- if .Values.csi.rbdPodLabels }}
ROOK_CSI_RBD_POD_LABELS: {{ .Values.csi.rbdPodLabels | quote }}
{{- end }}
{{- if .Values.csi.provisionerTolerations }}
CSI_PROVISIONER_TOLERATIONS: {{ toYaml .Values.csi.provisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.provisionerNodeAffinity }}
CSI_PROVISIONER_NODE_AFFINITY: {{ .Values.csi.provisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.rbdProvisionerTolerations }}
CSI_RBD_PROVISIONER_TOLERATIONS: {{ toYaml .Values.csi.rbdProvisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.rbdProvisionerNodeAffinity }}
CSI_RBD_PROVISIONER_NODE_AFFINITY: {{ .Values.csi.rbdProvisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephFSProvisionerTolerations }}
CSI_CEPHFS_PROVISIONER_TOLERATIONS: {{ toYaml .Values.csi.cephFSProvisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.cephFSProvisionerNodeAffinity }}
CSI_CEPHFS_PROVISIONER_NODE_AFFINITY: {{ .Values.csi.cephFSProvisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.allowUnsupportedVersion }}
ROOK_CSI_ALLOW_UNSUPPORTED_VERSION: {{ .Values.csi.allowUnsupportedVersion | quote }}
{{- end }}
{{- if .Values.csi.pluginTolerations }}
CSI_PLUGIN_TOLERATIONS: {{ toYaml .Values.csi.pluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.pluginNodeAffinity }}
CSI_PLUGIN_NODE_AFFINITY: {{ .Values.csi.pluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.rbdPluginTolerations }}
CSI_RBD_PLUGIN_TOLERATIONS: {{ toYaml .Values.csi.rbdPluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.rbdPluginNodeAffinity }}
CSI_RBD_PLUGIN_NODE_AFFINITY: {{ .Values.csi.rbdPluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephFSPluginTolerations }}
CSI_CEPHFS_PLUGIN_TOLERATIONS: {{ toYaml .Values.csi.cephFSPluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.cephFSPluginNodeAffinity }}
CSI_CEPHFS_PLUGIN_NODE_AFFINITY: {{ .Values.csi.cephFSPluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephfsGrpcMetricsPort }}
CSI_CEPHFS_GRPC_METRICS_PORT: {{ .Values.csi.cephfsGrpcMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.cephfsLivenessMetricsPort }}
CSI_CEPHFS_LIVENESS_METRICS_PORT: {{ .Values.csi.cephfsLivenessMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.rbdGrpcMetricsPort }}
CSI_RBD_GRPC_METRICS_PORT: {{ .Values.csi.rbdGrpcMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.rbdLivenessMetricsPort }}
CSI_RBD_LIVENESS_METRICS_PORT: {{ .Values.csi.rbdLivenessMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.forceCephFSKernelClient }}
CSI_FORCE_CEPHFS_KERNEL_CLIENT: {{ .Values.csi.forceCephFSKernelClient | quote }}
{{- end }}
{{- if .Values.csi.logLevel }}
CSI_LOG_LEVEL: {{ .Values.csi.logLevel | quote }}
{{- end }}
{{- if .Values.csi.provisionerReplicas }}
CSI_PROVISIONER_REPLICAS: {{ .Values.csi.provisionerReplicas | quote }}
{{- end }}
{{- if .Values.csi.csiRBDProvisionerResource }}
CSI_RBD_PROVISIONER_RESOURCE: {{ .Values.csi.csiRBDProvisionerResource | quote }}
{{- end }}
{{- if .Values.csi.csiRBDPluginResource }}
CSI_RBD_PLUGIN_RESOURCE: {{ .Values.csi.csiRBDPluginResource | quote }}
{{- end }}
{{- if .Values.csi.csiCephFSProvisionerResource }}
CSI_CEPHFS_PROVISIONER_RESOURCE: {{ .Values.csi.csiCephFSProvisionerResource | quote }}
{{- end }}
{{- if .Values.csi.csiCephFSPluginResource }}
CSI_CEPHFS_PLUGIN_RESOURCE: {{ .Values.csi.csiCephFSPluginResource | quote }}
{{- end }}
{{- end }}
@@ -68,222 +68,12 @@ spec:
{{- end }}
- name: ROOK_HOSTPATH_REQUIRES_PRIVILEGED
value: "{{ .Values.hostpathRequiresPrivileged }}"
- name: ROOK_LOG_LEVEL
value: {{ .Values.logLevel }}
- name: ROOK_ENABLE_SELINUX_RELABELING
value: "{{ .Values.enableSelinuxRelabeling }}"
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: "{{ .Values.disableDeviceHotplug }}"
{{- if .Values.csi }}
- name: ROOK_CSI_ENABLE_RBD
value: {{ .Values.csi.enableRbdDriver | quote }}
- name: ROOK_CSI_ENABLE_CEPHFS
value: {{ .Values.csi.enableCephfsDriver | quote }}
- name: CSI_ENABLE_CEPHFS_SNAPSHOTTER
value: {{ .Values.csi.enableCephfsSnapshotter | quote }}
- name: CSI_ENABLE_RBD_SNAPSHOTTER
value: {{ .Values.csi.enableRBDSnapshotter | quote }}
- name: CSI_PLUGIN_PRIORITY_CLASSNAME
value: {{ .Values.csi.pluginPriorityClassName | quote }}
- name: CSI_PROVISIONER_PRIORITY_CLASSNAME
value: {{ .Values.csi.provisionerPriorityClassName | quote }}
- name: CSI_ENABLE_OMAP_GENERATOR
value: {{ .Values.csi.enableOMAPGenerator | quote }}
- name: CSI_ENABLE_VOLUME_REPLICATION
value: {{ .Values.csi.volumeReplication.enabled | quote }}
- name: CSI_ENABLE_CSIADDONS
value: {{ .Values.csi.csiAddons.enabled | quote }}
- name: CSI_PLUGIN_ENABLE_SELINUX_HOST_MOUNT
value: {{ .Values.csi.enablePluginSelinuxHostMount | quote }}
{{- if .Values.csi.enableCSIHostNetwork }}
- name: CSI_ENABLE_HOST_NETWORK
value: {{ .Values.csi.enableCSIHostNetwork | quote }}
{{- end }}
{{- if .Values.csi.cephFSPluginUpdateStrategy }}
- name: CSI_CEPHFS_PLUGIN_UPDATE_STRATEGY
value: {{ .Values.csi.cephFSPluginUpdateStrategy | quote }}
{{- end }}
{{- if .Values.csi.rbdFSGroupPolicy }}
- name: CSI_RBD_FSGROUPPOLICY
value: {{ .Values.csi.rbdFSGroupPolicy | quote }}
{{- end }}
{{- if .Values.csi.cephFSFSGroupPolicy }}
- name: CSI_CEPHFS_FSGROUPPOLICY
value: {{ .Values.csi.cephFSFSGroupPolicy | quote }}
{{- end }}
{{- if .Values.csi.rbdPluginUpdateStrategy }}
- name: CSI_RBD_PLUGIN_UPDATE_STRATEGY
value: {{ .Values.csi.rbdPluginUpdateStrategy | quote }}
{{- end }}
{{- if .Values.csi.kubeletDirPath }}
- name: ROOK_CSI_KUBELET_DIR_PATH
value: {{ .Values.csi.kubeletDirPath | quote }}
{{- end }}
- name: ROOK_CSI_ENABLE_GRPC_METRICS
value: {{ .Values.csi.enableGrpcMetrics | quote }}
{{- if .Values.csi.cephcsi }}
{{- if .Values.csi.cephcsi.image }}
- name: ROOK_CSI_CEPH_IMAGE
value: {{ .Values.csi.cephcsi.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.registrar }}
{{- if .Values.csi.registrar.image }}
- name: ROOK_CSI_REGISTRAR_IMAGE
value: {{ .Values.csi.registrar.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.provisioner }}
{{- if .Values.csi.provisioner.image }}
- name: ROOK_CSI_PROVISIONER_IMAGE
value: {{ .Values.csi.provisioner.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.snapshotter }}
{{- if .Values.csi.snapshotter.image }}
- name: ROOK_CSI_SNAPSHOTTER_IMAGE
value: {{ .Values.csi.snapshotter.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.attacher }}
{{- if .Values.csi.attacher.image }}
- name: ROOK_CSI_ATTACHER_IMAGE
value: {{ .Values.csi.attacher.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.resizer }}
{{- if .Values.csi.resizer.image }}
- name: ROOK_CSI_RESIZER_IMAGE
value: {{ .Values.csi.resizer.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.volumeReplication }}
{{- if .Values.csi.volumeReplication.image }}
- name: CSI_VOLUME_REPLICATION_IMAGE
value: {{ .Values.csi.volumeReplication.image | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.csiAddons }}
{{- if .Values.csi.csiAddons.image }}
- name: ROOK_CSIADDONS_IMAGE
value: {{ .Values.csi.csiAddons.image | quote }}
{{- end }}
{{- if .Values.csi.csiAddonsPort }}
- name: CSIADDONS_PORT
value: {{ .Values.csi.csiAddonsPort | quote }}
{{- end }}
{{- end }}
{{- if .Values.csi.cephfsPodLabels }}
- name: ROOK_CSI_CEPHFS_POD_LABELS
value: {{ .Values.csi.cephfsPodLabels | quote }}
{{- end }}
{{- if .Values.csi.rbdPodLabels }}
- name: ROOK_CSI_RBD_POD_LABELS
value: {{ .Values.csi.rbdPodLabels | quote }}
{{- end }}
{{- if .Values.csi.provisionerTolerations }}
- name: CSI_PROVISIONER_TOLERATIONS
value: {{ toYaml .Values.csi.provisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.provisionerNodeAffinity }}
- name: CSI_PROVISIONER_NODE_AFFINITY
value: {{ .Values.csi.provisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.rbdProvisionerTolerations }}
- name: CSI_RBD_PROVISIONER_TOLERATIONS
value: {{ toYaml .Values.csi.rbdProvisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.rbdProvisionerNodeAffinity }}
- name: CSI_RBD_PROVISIONER_NODE_AFFINITY
value: {{ .Values.csi.rbdProvisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephFSProvisionerTolerations }}
- name: CSI_CEPHFS_PROVISIONER_TOLERATIONS
value: {{ toYaml .Values.csi.cephFSProvisionerTolerations | quote }}
{{- end }}
{{- if .Values.csi.cephFSProvisionerNodeAffinity }}
- name: CSI_CEPHFS_PROVISIONER_NODE_AFFINITY
value: {{ .Values.csi.cephFSProvisionerNodeAffinity }}
{{- end }}
{{- if .Values.csi.allowUnsupportedVersion }}
- name: ROOK_CSI_ALLOW_UNSUPPORTED_VERSION
value: {{ .Values.csi.allowUnsupportedVersion | quote }}
{{- end }}
{{- if .Values.csi.pluginTolerations }}
- name: CSI_PLUGIN_TOLERATIONS
value: {{ toYaml .Values.csi.pluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.pluginNodeAffinity }}
- name: CSI_PLUGIN_NODE_AFFINITY
value: {{ .Values.csi.pluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.rbdPluginTolerations }}
- name: CSI_RBD_PLUGIN_TOLERATIONS
value: {{ toYaml .Values.csi.rbdPluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.rbdPluginNodeAffinity }}
- name: CSI_RBD_PLUGIN_NODE_AFFINITY
value: {{ .Values.csi.rbdPluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephFSPluginTolerations }}
- name: CSI_CEPHFS_PLUGIN_TOLERATIONS
value: {{ toYaml .Values.csi.cephFSPluginTolerations | quote }}
{{- end }}
{{- if .Values.csi.cephFSPluginNodeAffinity }}
- name: CSI_CEPHFS_PLUGIN_NODE_AFFINITY
value: {{ .Values.csi.cephFSPluginNodeAffinity }}
{{- end }}
{{- if .Values.csi.cephfsGrpcMetricsPort }}
- name: CSI_CEPHFS_GRPC_METRICS_PORT
value: {{ .Values.csi.cephfsGrpcMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.cephfsLivenessMetricsPort }}
- name: CSI_CEPHFS_LIVENESS_METRICS_PORT
value: {{ .Values.csi.cephfsLivenessMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.rbdGrpcMetricsPort }}
- name: CSI_RBD_GRPC_METRICS_PORT
value: {{ .Values.csi.rbdGrpcMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.rbdLivenessMetricsPort }}
- name: CSI_RBD_LIVENESS_METRICS_PORT
value: {{ .Values.csi.rbdLivenessMetricsPort | quote }}
{{- end }}
{{- if .Values.csi.forceCephFSKernelClient }}
- name: CSI_FORCE_CEPHFS_KERNEL_CLIENT
value: {{ .Values.csi.forceCephFSKernelClient | quote }}
{{- end }}
{{- if .Values.csi.logLevel }}
- name: CSI_LOG_LEVEL
value: {{ .Values.csi.logLevel | quote }}
{{- end }}
{{- if .Values.csi.provisionerReplicas }}
- name: CSI_PROVISIONER_REPLICAS
value: {{ .Values.csi.provisionerReplicas | quote }}
{{- end }}
{{- if .Values.csi.csiRBDProvisionerResource }}
- name: CSI_RBD_PROVISIONER_RESOURCE
value: {{ .Values.csi.csiRBDProvisionerResource | quote }}
{{- end }}
{{- if .Values.csi.csiRBDPluginResource }}
- name: CSI_RBD_PLUGIN_RESOURCE
value: {{ .Values.csi.csiRBDPluginResource | quote }}
{{- end }}
{{- if .Values.csi.csiCephFSProvisionerResource }}
- name: CSI_CEPHFS_PROVISIONER_RESOURCE
value: {{ .Values.csi.csiCephFSProvisionerResource | quote }}
{{- end }}
{{- if .Values.csi.csiCephFSPluginResource }}
- name: CSI_CEPHFS_PLUGIN_RESOURCE
value: {{ .Values.csi.csiCephFSPluginResource | quote }}
{{- end }}
{{- end }}
- name: ROOK_ENABLE_DISCOVERY_DAEMON
value: "{{ .Values.enableDiscoveryDaemon }}"
- name: ROOK_CEPH_COMMANDS_TIMEOUT_SECONDS
value: "{{ .Values.cephCommandsTimeoutSeconds }}"
- name: ROOK_OBC_WATCH_OPERATOR_NAMESPACE
value: "{{ .Values.enableOBCWatchOperatorNamespace }}"
- name: NODE_NAME
valueFrom:
@@ -47,9 +47,6 @@ func (h *CephInstaller) CreateRookOperatorViaHelm(values map[string]interface{})
if err := h.k8shelper.CreateNamespace(h.settings.OperatorNamespace); err != nil {
return errors.Errorf("failed to create namespace %s. %v", h.settings.Namespace, err)
}
if err := h.k8shelper.CreateOpConfigMap(h.settings.OperatorNamespace); err != nil {
return errors.Errorf("failed to create operator config map. %v", err)
}
if err := h.startAdmissionController(); err != nil {
return errors.Errorf("failed to start admission controllers. %v", err)
}
-17
View File
@@ -37,7 +37,6 @@ import (
rookclient "github.com/rook/rook/pkg/client/clientset/versioned"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/ceph/cluster/crash"
"github.com/rook/rook/pkg/operator/ceph/controller"
"github.com/rook/rook/pkg/operator/k8sutil"
"github.com/rook/rook/pkg/util/exec"
"github.com/stretchr/testify/require"
@@ -375,22 +374,6 @@ func (k8sh *K8sHelper) CreateNamespace(namespace string) error {
return nil
}
func (k8sh *K8sHelper) CreateOpConfigMap(namespace string) error {
ctx := context.TODO()
cm := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: controller.OperatorSettingConfigMapName,
Namespace: namespace,
},
}
_, err := k8sh.Clientset.CoreV1().ConfigMaps(namespace).Create(ctx, cm, metav1.CreateOptions{})
if err != nil && !kerrors.IsAlreadyExists(err) {
return fmt.Errorf("failed to create operator config map %s. %+v", controller.OperatorSettingConfigMapName, err)
}
return nil
}
func (k8sh *K8sHelper) CountPodsWithLabel(label string, namespace string) (int, error) {
ctx := context.TODO()
options := metav1.ListOptions{LabelSelector: label}