mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-31 06:26:19 -02:30
local_volume_provisioner: match upstream storage class syntax (#13504)
Use the upstream keys without converting them to snake case. This avoids converting back to camel case when rendering, and aligns ourselves more with our upstream.
This commit is contained in:
-12
@@ -1,14 +1,3 @@
|
||||
# Macro to convert camelCase dictionary keys to snake_case keys
|
||||
{% macro convert_keys(mydict) -%}
|
||||
{% for key in mydict.keys() | list -%}
|
||||
{% set key_split = key.split('_') -%}
|
||||
{% set new_key = key_split[0] + key_split[1:] | map('capitalize') | join -%}
|
||||
{% set value = mydict.pop(key) -%}
|
||||
{{ mydict.__setitem__(new_key, value) -}}
|
||||
{{ convert_keys(value) if value is mapping else None -}}
|
||||
{% endfor -%}
|
||||
{% endmacro -%}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -28,6 +17,5 @@ data:
|
||||
storageClassMap: |
|
||||
{% for class_name, storage_class in local_volume_provisioner_storage_classes.items() %}
|
||||
{{ class_name }}:
|
||||
{{- convert_keys(storage_class) }}
|
||||
{{ storage_class | to_nice_yaml(indent=2) | indent(6) }}
|
||||
{%- endfor %}
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ spec:
|
||||
name: provisioner-dev
|
||||
{% for class_name, class_config in local_volume_provisioner_storage_classes.items() %}
|
||||
- name: local-volume-provisioner-hostpath-{{ class_name }}
|
||||
mountPath: {{ class_config.mount_dir }}
|
||||
mountPath: {{ class_config.mountDir }}
|
||||
mountPropagation: "HostToContainer"
|
||||
{% endfor %}
|
||||
volumes:
|
||||
@@ -64,5 +64,5 @@ spec:
|
||||
{% for class_name, class_config in local_volume_provisioner_storage_classes.items() %}
|
||||
- name: local-volume-provisioner-hostpath-{{ class_name }}
|
||||
hostPath:
|
||||
path: {{ class_config.host_dir }}
|
||||
path: {{ class_config.hostDir }}
|
||||
{% endfor %}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ metadata:
|
||||
name: {{ class_name }}
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
{% if class_config.reclaim_policy is defined %}
|
||||
reclaimPolicy: {{ class_config.reclaim_policy }}
|
||||
{% if class_config.reclaimPolicy is defined %}
|
||||
reclaimPolicy: {{ class_config.reclaimPolicy }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user