Skip to content

Commit

Permalink
rook: Fixes to templates and helpers for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
aarnq authored and crssnd committed Feb 28, 2024
1 parent 8f6dfef commit 0c2d0e2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
8 changes: 4 additions & 4 deletions rook/helmfile.d/upstream/rook-ceph/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ data:
ROOK_CSI_RBD_POD_LABELS: {{ .Values.csi.rbdPodLabels | quote }}
{{- end }}
{{- if .Values.csi.provisionerTolerations }}
CSI_PROVISIONER_TOLERATIONS: {{ toYaml .Values.csi.provisionerTolerations | quote }}
CSI_PROVISIONER_TOLERATIONS: | {{- toYaml .Values.csi.provisionerTolerations | nindent 4 }}
{{- end }}
{{- if .Values.csi.provisionerNodeAffinity }}
CSI_PROVISIONER_NODE_AFFINITY: {{ .Values.csi.provisionerNodeAffinity }}
Expand All @@ -146,7 +146,7 @@ data:
ROOK_CSI_ALLOW_UNSUPPORTED_VERSION: {{ .Values.csi.allowUnsupportedVersion | quote }}
{{- end }}
{{- if .Values.csi.pluginTolerations }}
CSI_PLUGIN_TOLERATIONS: {{ toYaml .Values.csi.pluginTolerations | quote }}
CSI_PLUGIN_TOLERATIONS: | {{- toYaml .Values.csi.pluginTolerations | nindent 4 }}
{{- end }}
{{- if .Values.csi.pluginNodeAffinity }}
CSI_PLUGIN_NODE_AFFINITY: {{ .Values.csi.pluginNodeAffinity }}
Expand Down Expand Up @@ -203,10 +203,10 @@ data:
CSI_PROVISIONER_REPLICAS: {{ .Values.csi.provisionerReplicas | quote }}
{{- end }}
{{- if .Values.csi.csiRBDProvisionerResource }}
CSI_RBD_PROVISIONER_RESOURCE: {{ .Values.csi.csiRBDProvisionerResource | quote }}
CSI_RBD_PROVISIONER_RESOURCE: | {{- toYaml .Values.csi.csiRBDProvisionerResource | nindent 4 }}
{{- end }}
{{- if .Values.csi.csiRBDPluginResource }}
CSI_RBD_PLUGIN_RESOURCE: {{ .Values.csi.csiRBDPluginResource | quote }}
CSI_RBD_PLUGIN_RESOURCE: | {{ toYaml .Values.csi.csiRBDPluginResource | nindent 4 }}
{{- end }}
{{- if .Values.csi.csiCephFSProvisionerResource }}
CSI_CEPHFS_PROVISIONER_RESOURCE: {{ .Values.csi.csiCephFSProvisionerResource | quote }}
Expand Down
12 changes: 6 additions & 6 deletions rook/helmfile.d/values/cluster.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ cephClusterSpec:
port: 7000
ssl: false

monitoring:
enabled: {{ .Values | get "monitoring.installServiceMonitors" false }}

mgr:
count: {{ $cluster | get "mgr.count" 1 }}

Expand All @@ -48,16 +45,16 @@ cephClusterSpec:
{{- range $name, $spec := . }}
{{- $rules := pick $spec "nodeAffinity" "tolerations" "topologySpreadConstraints" }}
{{- with $rules }}
{{ $name }}: {{- toYaml $spec | nindent 6 }}
{{ $name }}: {{- toYaml $rules | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}

{{ $resources := pick $cluster "crashCollector" "logCollector" "mgr" "mon" "osd" "prepareosd" "cleanup" "exporter" }}
{{ $resources := pick $cluster "crashCollector" "logCollector" "mgr" "mgr-sidecar" "mon" "osd" "prepareosd" "cleanup" "exporter" }}
{{- range $resources }}{{ if hasKey . "resources" }}
resources: {{- break }}
{{- end }}{{ end }}
{{- range $name, $spec := pick $cluster "crashCollector" "logCollector" "mgr" "mon" "osd" "prepareosd" "cleanup" "exporter" }}
{{- range $name, $spec := pick $cluster "crashCollector" "logCollector" "mgr" "mgr-sidecar" "mon" "osd" "prepareosd" "cleanup" "exporter" }}
{{- with $spec | get "resources" dict }}
{{ $name | lower }}: {{- toYaml . | nindent 6 }}
{{- end }}
Expand Down Expand Up @@ -105,3 +102,6 @@ cephBlockPools:
cephFileSystems: []

cephObjectStores: []

monitoring:
enabled: {{ .Values | get "monitoring.installServiceMonitors" false }}
4 changes: 2 additions & 2 deletions rook/helmfile.d/values/operator.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tolerations: {{- toYaml . | nindent 2 }}
csi:
enableCephfsDriver: false

csiRBDProvisionerResource: |
csiRBDProvisionerResource:
{{- range $name, $config := omit .Values.provisioner "tolerations" }}
- name: {{ $name }}
{{- with get "resources" dict $config }}
Expand All @@ -28,7 +28,7 @@ csi:

provisionerTolerations: {{- toYaml .Values.provisioner.tolerations | nindent 4 }}

csiRBDPluginResource: |
csiRBDPluginResource:
{{- range $name, $config := omit .Values.plugin "tolerations" }}
- name: {{ $name }}
{{- with get "resources" dict $config }}
Expand Down
18 changes: 15 additions & 3 deletions rook/migration/v1.11/prepare/diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,32 @@ fi
block_pool="$(yq4 ".commons * .clusters.${1} | .cluster.cephBlockPool.name // \"replicapool\"" "${CK8S_CONFIG_PATH}/rook/values.yaml")"
storage_class="$(yq4 ".commons * .clusters.${1} | .cluster.storageClass.name // \"rook-ceph-block\"" "${CK8S_CONFIG_PATH}/rook/values.yaml")"

echo "diffing operator..."
diff -u100 --color \
--label current <(kubectl -n rook-ceph get deployment rook-ceph-operator -oyaml | yq4 'sort_keys(...) | del(.metadata.annotations,.metadata.creationTimestamp,.metadata.finalizers,.metadata.generation,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.status)') \
--label pending <(helmfile -e "${1}" -l app=operator template | yq4 'select(.kind == "Deployment") | sort_keys(...)')
echo "---"

echo "diffing operator config..."
diff -u100 --color \
--label current <(kubectl -n rook-ceph get configmap rook-ceph-operator-config -oyaml | yq4 'sort_keys(...) | del(.metadata.annotations,.metadata.creationTimestamp,.metadata.finalizers,.metadata.generation,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.status)') \
--label pending <(helmfile -e "${1}" -l app=operator template | yq4 'select(.kind == "ConfigMap") | sort_keys(...)')
echo "---"

echo "diffing cluster..."
diff -u3 --color \
diff -u100 --color \
--label current <(kubectl -n rook-ceph get cephclusters.ceph.rook.io rook-ceph -oyaml | yq4 'sort_keys(...) | del(.metadata.annotations,.metadata.creationTimestamp,.metadata.finalizers,.metadata.generation,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.status)') \
--label pending <(helmfile -e "${1}" -l app=cluster template | yq4 'select(.kind == "CephCluster") | sort_keys(...)')
echo "---"

echo "diffing block pool..."
diff -u3 --color \
diff -u100 --color \
--label current <(kubectl -n rook-ceph get cephblockpools.ceph.rook.io "${block_pool}" -oyaml | yq4 'sort_keys(...) | del(.metadata.annotations,.metadata.creationTimestamp,.metadata.finalizers,.metadata.generation,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.status)') \
--label pending <(helmfile -e service -l app=cluster template | yq4 'select(.kind == "CephBlockPool") | sort_keys(...)')
echo "---"

echo "diffing storage class..."
diff -u3 --color \
diff -u100 --color \
--label current <(kubectl -n rook-ceph get storageclass "${storage_class}" -oyaml | yq4 'sort_keys(...) | del(.metadata.annotations,.metadata.creationTimestamp,.metadata.finalizers,.metadata.generation,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.status)') \
--label pending <(helmfile -e service -l app=cluster template | yq4 'select(.kind == "StorageClass") | sort_keys(...)')
echo "---"

0 comments on commit 0c2d0e2

Please sign in to comment.