1
1
#! /bin/bash
2
2
set -euo pipefail
3
3
4
- SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
4
+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
5
5
6
6
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' ) "
8
8
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' ) "
10
10
fi
11
11
12
12
CRDS=(
@@ -23,29 +23,29 @@ CRDS=(
23
23
)
24
24
25
25
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
29
29
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 "
31
31
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"
33
33
34
- echo " # ${URL} " > " ${SCRIPT_DIR} /../charts/crds/templates/${DESTINATION} "
34
+ echo " # ${URL} " > " ${SCRIPT_DIR} /../charts/crds/templates/${DESTINATION} "
35
35
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
40
40
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
47
47
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} "
51
51
done
0 commit comments