Files
manifests/argocd/kustomize-helm-with-rewrite/get-values.sh
T
2024-06-05 12:48:29 +02:00

29 lines
593 B
Bash

#!/bin/sh
if [ -f values.yaml ]; then
VALUES="values.yaml"
elif [ -f values-chart.yaml ]; then
VALUES="values-chart.yaml"
elif [ -f chart/values.yaml ]; then
VALUES="chart/values.yaml"
else
cat << EOF
[{
"name": "helm-parameters",
"title": "Helm Parameters",
"collectionType": "map",
"map": { "replicaCount": "1" }
}]
EOF
exit 0
fi
yq e -o=p $VALUES | jq --slurp --raw-input '
[{
name: "helm-parameters",
title: "Helm Parameters",
collectionType: "map",
map: split("\n") | map(capture("(?<key>.*) = (?<value>.*)")) | from_entries
}]'