From 0737030a3254ad0a8507c5adc342cd9f79791880 Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Sun, 9 Mar 2025 22:33:07 +0100 Subject: [PATCH] Add Makefile to download and patch CRDs --- .helmignore | 3 ++- Makefile | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.helmignore b/.helmignore index f72da33..e40aded 100644 --- a/.helmignore +++ b/.helmignore @@ -28,4 +28,5 @@ README.md *.tmproj .vscode/ config -tests/ \ No newline at end of file +tests/ +Makefile \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9204058 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +.PHONY: fetch_crds all + +# https://github.com/prometheus-community/helm-charts/releases +VERSION ?= 13.0.2 + +CRDS_PATH = charts/crds/crds +URL = https://github.com/prometheus-community/helm-charts/releases/download/prometheus-operator-crds-$(VERSION)/prometheus-operator-crds-$(VERSION).tgz + +fetch_crds: + rm -rf ${CRDS_PATH}/*.yaml + curl -s -L -o - ${URL} | tar -C ${CRDS_PATH} --strip-components=4 -xzf - prometheus-operator-crds/charts/crds/templates + find ${CRDS_PATH} -type f -name '*.yaml' -exec sed -i '/{{- with .Values.annotations }}/d' {} + + find ${CRDS_PATH} -type f -name '*.yaml' -exec sed -i '/{{- toYaml . | nindent 4 }}/d' {} + + find ${CRDS_PATH} -type f -name '*.yaml' -exec sed -i '/{{- end }}/d' {} + + sed -i '/^ annotations:/a \ argocd.argoproj.io/sync-options: ServerSideApply=true' ${CRDS_PATH}/*.yaml + +all: fetch_crds -- GitLab