Trim dns-names after spliting
Hello,
I want to use yaml to have a better readbility of the field csi.cert-manager.io/dns-names. For example :
csi:
readOnly: true
driver: csi.cert-manager.io
volumeAttributes:
csi.cert-manager.io/issuer-name: log-ca-issuer
csi.cert-manager.io/key-usages: server auth,client auth
csi.cert-manager.io/key-encoding: PKCS8
csi.cert-manager.io/common-name: log-opensearch-node
csi.cert-manager.io/dns-names: >-
${POD_NAME},
opensearch-cluster-master-headless,
${POD_NAME}.opensearch-cluster-master-headless,
${POD_NAME}.opensearch-cluster-master-headless.${POD_NAMESPACE}.svc.cluster.local,
opensearch-cluster-master-headless.${POD_NAMESPACE}.svc.cluster.local
This yaml feature will regroup data like this :
${POD_NAME}, opensearch-cluster-master-headless, ${POD_NAME}.opensearch-cluster-master-headless, ${POD_NAME}.opensearch-cluster-master-headless.${POD_NAMESPACE}.svc.cluster.local, opensearch-cluster-master-headless.${POD_NAMESPACE}.svc.cluster.local
Is it possible to trim DNS names after splitting to avoid extra space produce by yaml ?
Yes, this is a clear improvement to me. DNS doesn't contain space characters so we can safely omit them when they appear:
- before the start of the first entry
- after a comma separator
- trailing
We can achieve this by splitting the csv, and then using string.TrimSpace on every item.
We should extend this to all list typed attributes.
/assign