From 1ff8e343fb830600db14de028975c3b100845412 Mon Sep 17 00:00:00 2001 From: Ariel Sosnovsky Date: Thu, 13 Apr 2023 21:32:28 +0000 Subject: [PATCH] consistent references --- bin/install-app.sh | 37 +++++++++++++++++++ bin/install-argo.sh | 6 ++- k8s/argocd/templates/app-self.yaml | 9 ++++- .../values/shared/infrastructureCharts.yaml | 34 +++++++++++++++++ 4 files changed, 83 insertions(+), 3 deletions(-) create mode 100755 bin/install-app.sh diff --git a/bin/install-app.sh b/bin/install-app.sh new file mode 100755 index 0000000..e08f86b --- /dev/null +++ b/bin/install-app.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -e + +full_path=${1} +deployment=${2:-dev} +action=${3:-install} +app=$(basename $full_path) +location=$(dirname $full_path) +tmp_path=".tmp/$location/$deployment-$app.yaml" + + +mkdir -p $(dirname $tmp_path) + +pushd $full_path &> /dev/null +helm dependency update &> /dev/null +popd &> /dev/null + +extraArgs="" +for f in k8s/argocd/values/shared/*.yaml; do + full_file_path=$(realpath $f) + extraArgs=$extraArgs" --values ${full_file_path}" +done +for f in k8s/argocd/values/$deployment/*.yaml; do + full_file_path=$(realpath $f) + extraArgs=$extraArgs" --values ${full_file_path}" +done + +echo "Installing $app" + +helm $action $app $full_path --namespace $app \ + --debug \ + --values $full_path/values.yaml \ + --create-namespace \ + --dependency-update \ + $extraArgs \ + > $tmp_path + diff --git a/bin/install-argo.sh b/bin/install-argo.sh index be8913f..f739698 100755 --- a/bin/install-argo.sh +++ b/bin/install-argo.sh @@ -13,7 +13,8 @@ helm install argocd k8s/argocd \ --namespace argocd \ --create-namespace \ --values k8s/argocd/values.yaml \ - --set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" + --set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" \ + --set selfapp.deployment=$DEPLOYMENT watch -n1 "kubectl -n argocd get all" @@ -26,6 +27,7 @@ helm upgrade argocd k8s/argocd \ --create-namespace \ --values k8s/argocd/values.yaml \ --set selfapp.enabled="true" \ - --set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" + --set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" \ + --set selfapp.deployment=$DEPLOYMENT argocd app sync argocd/argocd \ No newline at end of file diff --git a/k8s/argocd/templates/app-self.yaml b/k8s/argocd/templates/app-self.yaml index 701a86c..01ad765 100644 --- a/k8s/argocd/templates/app-self.yaml +++ b/k8s/argocd/templates/app-self.yaml @@ -49,6 +49,8 @@ spec: valueFiles: - values.yaml parameters: + - name: "selfapp.deployment" + value: {{ .Values.selfapp.deployment | quote }} - name: "selfapp.enabled" value: "true" - name: "selfapp.sshkey" @@ -57,6 +59,11 @@ spec: server: https://kubernetes.default.svc namespace: "{{ .Release.Namespace }}" +--- +apiVersion: v1 +kind: Namespace +metadata: + name: "argoapps" --- apiVersion: argoproj.io/v1alpha1 @@ -77,6 +84,6 @@ spec: {{- $appvalues | toYaml | nindent 8 }} destination: server: https://kubernetes.default.svc - namespace: "{{ .Release.Namespace }}" + namespace: "argoapps" {{- end -}} \ No newline at end of file diff --git a/k8s/argocd/values/shared/infrastructureCharts.yaml b/k8s/argocd/values/shared/infrastructureCharts.yaml index f62cf59..fa54b17 100644 --- a/k8s/argocd/values/shared/infrastructureCharts.yaml +++ b/k8s/argocd/values/shared/infrastructureCharts.yaml @@ -22,3 +22,37 @@ infrastructureCharts: kubernetes-secret-generator: repoURL: "https://helm.mittwald.de" targetRevision: "v3.4.0" + # monitoring: + # chart: prometheus + # repoURL: "https://prometheus-community.github.io/helm-charts" + # targetRevision: "20.2.0" + # values: |- + # configmapReload: + # prometheus: + # enabled: false + # alertmanager: + # persistence: + # enabled: true + # size: 8Gi + # storageClass: "local-path" + # ingress: + # enabled: false + # ingressClassName: traefik + # annotations: {} + # hosts: + # - host: "{{$prometheusHost}}.{{ .Values.global.domain }}" + # paths: + # - path: /alertmanager + # pathType: Prefix + # server: + # {{ if .Values.global.tls.enabled }} + # baseURL: "https://{{$prometheusHost}}.{{ .Values.global.domain }}" + # {{ else }} + # baseURL: "http://{{$prometheusHost}}.{{ .Values.global.domain }}" + # {{ end }} + # persistentVolume: + # enabled: true + # size: 8Gi + # storageClass: "local-path" + # ingress: + # enabled: false \ No newline at end of file