From 2b70117a9a49170459a6f7fad972d287482eb816 Mon Sep 17 00:00:00 2001 From: Carlos Santana Date: Tue, 21 Mar 2023 10:35:53 -0400 Subject: [PATCH] update argo-app-of-apps Signed-off-by: Carlos Santana --- .../dev/templates/ecsdemo-crystal.yaml | 24 ++++----- .../dev/templates/ecsdemo-frontend.yaml | 23 ++++----- .../dev/templates/ecsdemo-nodejs.yaml | 22 ++++----- multi-repo/argo-app-of-apps/dev/values.yaml | 49 ++++++++++++------- 4 files changed, 67 insertions(+), 51 deletions(-) diff --git a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-crystal.yaml b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-crystal.yaml index 666ff9590..f8d537e6b 100644 --- a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-crystal.yaml +++ b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-crystal.yaml @@ -1,40 +1,40 @@ - apiVersion: argoproj.io/v1alpha1 +{{- if .Values.spec.apps.ecsdemoCrystal.createProject -}} +apiVersion: argoproj.io/v1alpha1 kind: AppProject metadata: - name: ecsdemo-crystal - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoCrystal.project | default "ecsdemo-crystal" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} # Finalizer that ensures that project is not deleted until it is not referenced by any application finalizers: - resources-finalizer.argocd.argoproj.io spec: destinations: - - namespace: ecsdemo-crystal - server: https://kubernetes.default.svc + - namespace: {{ .Values.spec.apps.ecsdemoCrystal.namespace | default "ecsdemo-crystal" }} + server: {{ .Values.spec.destination.server }} sourceRepos: - {{ .Values.spec.apps.ecsdemoCrystal.repoURL }} --- +{{- end }} apiVersion: argoproj.io/v1alpha1 kind: Application metadata: - name: ecsdemo-crystal - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoCrystal.name | default "ecsdemo-crystal" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} labels: {{- toYaml .Values.labels | nindent 4 }} finalizers: - resources-finalizer.argocd.argoproj.io spec: - project: ecsdemo-crystal + project: {{ .Values.spec.apps.ecsdemoCrystal.project | default "ecsdemo-crystal" }} destination: - namespace: ecsdemo-crystal + namespace: {{ .Values.spec.apps.ecsdemoCrystal.namespace | default "ecsdemo-crystal" }} server: {{ .Values.spec.destination.server }} source: repoURL: {{ .Values.spec.apps.ecsdemoCrystal.repoURL }} targetRevision: {{ .Values.spec.apps.ecsdemoCrystal.targetRevision }} path: {{ .Values.spec.apps.ecsdemoCrystal.path }} helm: - parameters: - - name: replicaCount - value: '3' + {{- toYaml .Values.spec.apps.ecsdemoCrystal.helm | nindent 6 }} syncPolicy: automated: prune: true diff --git a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-frontend.yaml b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-frontend.yaml index b38295ed0..4fb7d2dbf 100644 --- a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-frontend.yaml +++ b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-frontend.yaml @@ -1,41 +1,42 @@ +{{- if .Values.spec.apps.ecsdemoFrontend.createProject -}} apiVersion: argoproj.io/v1alpha1 kind: AppProject metadata: - name: ecsdemo-frontend - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoFrontend.project | default "ecsdemo-frontend" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} # Finalizer that ensures that project is not deleted until it is not referenced by any application finalizers: - resources-finalizer.argocd.argoproj.io spec: destinations: - - namespace: ecsdemo-frontend - server: https://kubernetes.default.svc + - namespace: {{ .Values.spec.apps.ecsdemoFrontend.namespace | default "ecsdemo-frontend" }} + server: {{ .Values.spec.destination.server }} sourceRepos: - {{ .Values.spec.apps.ecsdemoFrontend.repoURL }} +{{- end }} --- apiVersion: argoproj.io/v1alpha1 kind: Application metadata: - name: ecsdemo-frontend - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoFrontend.name | default "ecsdemo-frontend" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} labels: {{- toYaml .Values.labels | nindent 4 }} finalizers: - resources-finalizer.argocd.argoproj.io spec: - project: ecsdemo-frontend + project: {{ .Values.spec.apps.ecsdemoFrontend.project | default "ecsdemo-frontend" }} destination: - namespace: ecsdemo-frontend + namespace: {{ .Values.spec.apps.ecsdemoFrontend.namespace | default "ecsdemo-frontend" }} server: {{ .Values.spec.destination.server }} source: repoURL: {{ .Values.spec.apps.ecsdemoFrontend.repoURL }} targetRevision: {{ .Values.spec.apps.ecsdemoFrontend.targetRevision }} path: {{ .Values.spec.apps.ecsdemoFrontend.path }} helm: - values: |- - {{ toYaml .Values.spec.apps.ecsdemoFrontend | nindent 8 }} + {{- toYaml .Values.spec.apps.ecsdemoFrontend.helm | nindent 6 }} syncPolicy: automated: prune: true syncOptions: - - CreateNamespace=false # Created with IaC - https://github.com/argoproj/argo-cd/issues/7799 + - CreateNamespace=false # Created with IaC - # https://github.com/argoproj/argo-cd/issues/7799 diff --git a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-nodejs.yaml b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-nodejs.yaml index c998eb300..adaf18453 100644 --- a/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-nodejs.yaml +++ b/multi-repo/argo-app-of-apps/dev/templates/ecsdemo-nodejs.yaml @@ -1,40 +1,40 @@ +{{- if .Values.spec.apps.ecsdemoNodejs.createProject -}} apiVersion: argoproj.io/v1alpha1 kind: AppProject metadata: - name: ecsdemo-nodejs - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoNodejs.project | default "ecsdemo-nodejs" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} # Finalizer that ensures that project is not deleted until it is not referenced by any application finalizers: - resources-finalizer.argocd.argoproj.io spec: destinations: - - namespace: ecsdemo-nodejs - server: https://kubernetes.default.svc + - namespace: {{ .Values.spec.apps.ecsdemoNodejs.namespace | default "ecsdemo-nodejs" }} + server: {{ .Values.spec.destination.server }} sourceRepos: - {{ .Values.spec.apps.ecsdemoNodejs.repoURL }} --- +{{- end }} apiVersion: argoproj.io/v1alpha1 kind: Application metadata: - name: ecsdemo-nodejs - namespace: argocd + name: {{ .Values.spec.apps.ecsdemoNodejs.name | default "ecsdemo-nodejs" }} + namespace: {{ .Values.argoNamespace | default "argocd" }} labels: {{- toYaml .Values.labels | nindent 4 }} finalizers: - resources-finalizer.argocd.argoproj.io spec: - project: ecsdemo-nodejs + project: {{ .Values.spec.apps.ecsdemoNodejs.project | default "ecsdemo-nodejs" }} destination: - namespace: ecsdemo-nodejs + namespace: {{ .Values.spec.apps.ecsdemoNodejs.namespace | default "ecsdemo-nodejs" }} server: {{ .Values.spec.destination.server }} source: repoURL: {{ .Values.spec.apps.ecsdemoNodejs.repoURL }} targetRevision: {{ .Values.spec.apps.ecsdemoNodejs.targetRevision }} path: {{ .Values.spec.apps.ecsdemoNodejs.path }} helm: - parameters: - - name: replicaCount - value: '3' + {{- toYaml .Values.spec.apps.ecsdemoNodejs.helm | nindent 6 }} syncPolicy: automated: prune: true diff --git a/multi-repo/argo-app-of-apps/dev/values.yaml b/multi-repo/argo-app-of-apps/dev/values.yaml index e3a141305..cb60e9196 100644 --- a/multi-repo/argo-app-of-apps/dev/values.yaml +++ b/multi-repo/argo-app-of-apps/dev/values.yaml @@ -1,34 +1,49 @@ +argoNamespace: '' + labels: env: dev spec: destination: server: https://kubernetes.default.svc -# All helm parameters can be sent by IaC code (Terraform or CDK) +# All helm parameters can be sent by IaC code (Terraform or CDK) apps: ecsdemoFrontend: + createProject: true #repoURL: git@github.com:aws-containers/ecsdemo-frontend.git - repoURL: https://github.com/aws-containers/ecsdemo-frontend.git + repoURL: https://github.com/aws-containers/ecsdemo-frontend.git targetRevision: main path: kubernetes/helm/ecsdemo-frontend - ingress: - enabled: true - annotations: - alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]' - alb.ingress.kubernetes.io/scheme: internet-facing - alb.ingress.kubernetes.io/tags: Environment=dev,Team=ecsdemo-frontend - alb.ingress.kubernetes.io/target-type: ip - className: alb - hosts: - - paths: - - path: / - pathType: Prefix + helm: + values: |- + ingress: + enabled: true + annotations: + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]' + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/tags: Environment=dev,Team=ecsdemo-frontend + alb.ingress.kubernetes.io/target-type: ip + className: alb + hosts: + - paths: + - path: / + pathType: Prefix ecsdemoNodejs: - repoURL: https://github.com/aws-containers/ecsdemo-nodejs.git + createProject: true + repoURL: https://github.com/aws-containers/ecsdemo-nodejs.git #repoURL: git@github.com:aws-containers/ecsdemo-nodejs.git targetRevision: main path: kubernetes/helm/ecsdemo-nodejs + helm: + parameters: + - name: replicaCount + value: '3' ecsdemoCrystal: - repoURL: https://github.com/aws-containers/ecsdemo-crystal.git + createProject: true + repoURL: https://github.com/aws-containers/ecsdemo-crystal.git #repoURL: git@github.com:aws-containers/ecsdemo-crystal.git targetRevision: main - path: kubernetes/helm/ecsdemo-crystal \ No newline at end of file + path: kubernetes/helm/ecsdemo-crystal + helm: + parameters: + - name: replicaCount + value: '3' \ No newline at end of file