Skip to content

Commit 6a5a729

Browse files
committed
fixup! [prometheus-operator-crds] add opt-out for CRDs
Signed-off-by: Simon Berz <[email protected]>
1 parent 4448089 commit 6a5a729

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

Diff for: charts/prometheus-operator-crds/hack/update_crds.sh

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
55

66
if [[ $(uname -s) = "Darwin" ]]; then
7-
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')"
7+
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')"
88
else
9-
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')"
9+
VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')"
1010
fi
1111

1212
CRDS=(
@@ -23,29 +23,29 @@ CRDS=(
2323
)
2424

2525
for line in "${CRDS[@]}"; do
26-
CRD=$(echo "${line%%:*}" | xargs)
27-
SOURCE=$(echo "${line##*:}" | xargs)
28-
DESTINATION="crd-${CRD}".yaml
26+
CRD=$(echo "${line%%:*}" | xargs)
27+
SOURCE=$(echo "${line##*:}" | xargs)
28+
DESTINATION="crd-${CRD}".yaml
2929

30-
URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"
30+
URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"
3131

32-
echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"
32+
echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"
3333

34-
echo "# ${URL}" > "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
34+
echo "# ${URL}" >"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
3535

36-
if ! curl --silent --retry-all-errors --fail --location "${URL}" >> "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"; then
37-
echo -e "Failed to download ${URL}!"
38-
exit 1
39-
fi
36+
if ! curl --silent --retry-all-errors --fail --location "${URL}" >>"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"; then
37+
echo -e "Failed to download ${URL}!"
38+
exit 1
39+
fi
4040

41-
# Update or insert annotations block
42-
if yq -e '.metadata.annotations' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" >/dev/null; then
43-
sed -i '/^ annotations:$/a {{- with .Values.annotations }}\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
44-
else
45-
sed -i '/^metadata:$/a {{- with .Values.annotations }}\n annotations:\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
46-
fi
41+
# Update or insert annotations block
42+
if yq -e '.metadata.annotations' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" >/dev/null; then
43+
sed -i '/^ annotations:$/a {{- with .Values.annotations }}\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
44+
else
45+
sed -i '/^metadata:$/a {{- with .Values.annotations }}\n annotations:\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
46+
fi
4747

48-
# Insert enable option
49-
sed -i "1i\{{- if .Values.${CRD}.enabled -}}" "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
50-
echo "{{- end -}}" >> "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
48+
# Insert enable option
49+
sed -i "1i\{{- if .Values.${CRD}.enabled -}}" "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
50+
echo "{{- end -}}" >>"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"
5151
done

0 commit comments

Comments
 (0)