From 0d8368b29fcaa58ec72fa702374c1bd8b69f6565 Mon Sep 17 00:00:00 2001 From: Carlos de Paula Date: Mon, 15 Jun 2020 17:52:35 -0300 Subject: [PATCH] Improve change_suffix target --- Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index aab7bff..7342bc6 100644 --- a/Makefile +++ b/Makefile @@ -62,11 +62,10 @@ update_tools: ## Updates jsonnet, jsonnetfmt and jb utilities @go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb change_suffix: ## Changes suffix for the ingress. Pass suffix=[suffixURL] as argument - @sed -i -e "s/\(.*prometheus\.\).*/\1${suffix}/" manifests/ingress-prometheus.yaml - @sed -i -e "s/\(.*alertmanager\.\).*/\1${suffix}/" manifests/ingress-alertmanager.yaml - @sed -i -e "s/\(.*grafana\.\).*/\1${suffix}/" manifests/ingress-grafana.yaml @echo "Ingress IPs changed to [service].${suffix}" @echo "Apply to your cluster with:" - @echo ${K3S} kubectl apply -f manifests/ingress-alertmanager.yaml - @echo ${K3S} kubectl apply -f manifests/ingress-grafana.yaml - @echo ${K3S} kubectl apply -f manifests/ingress-prometheus.yaml + @for f in alertmanager prometheus grafana; do \ + cat manifests/ingress-$$f.yaml | sed -e "s/\(.*$$f\.\).*/\1${suffix}/" > manifests/ingress-$$f.yaml-tmp; \ + mv -f manifests/ingress-$$f.yaml-tmp manifests/ingress-$$f.yaml; \ + echo ${K3S} kubectl apply -f manifests/ingress-$$f.yaml; \ + done \ No newline at end of file