From b568d48b165512f2a4588eeac56b9a6b040ff3d8 Mon Sep 17 00:00:00 2001 From: Mathieu LAUDE Date: Tue, 9 Jul 2024 17:29:05 +0200 Subject: [PATCH] feat: :thread: split argo applications: one per repo --- .gitignore | 1 + charts/dso-env/Chart.yaml | 6 +++++- charts/dso-env/README.md | 17 ++++++++++----- charts/dso-env/templates/application-app.yaml | 21 ++++++++++++------- charts/dso-env/templates/application-env.yaml | 4 +++- charts/dso-env/templates/project-app.yaml | 4 +++- charts/dso-env/templates/project-env.yaml | 4 +++- charts/dso-env/values.yaml | 9 +++++--- charts/dso-ns/Chart.yaml | 6 +++++- charts/dso-ns/README.md | 10 +++++++-- charts/dso-ns/templates/ns.yaml | 2 ++ charts/dso-ns/templates/quota.yaml | 3 ++- charts/dso-ns/values.yaml | 1 - 13 files changed, 64 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index d109dd8..75b01ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # Helm chart automated files /charts/*/charts +/charts/*/Chart.lock diff --git a/charts/dso-env/Chart.yaml b/charts/dso-env/Chart.yaml index b0e6196..b3f85c5 100644 --- a/charts/dso-env/Chart.yaml +++ b/charts/dso-env/Chart.yaml @@ -2,5 +2,9 @@ apiVersion: v2 name: dso-env description: Creates argocd Project and Applications to deploy DSO project repositories. type: application -version: 1.1.1 +version: 1.2.0 appVersion: 1.0.0 +maintainers: + - name: this-is-tobi + email: thibault.colin@interieur.gouv.fr + url: https://this-is-tobi.com diff --git a/charts/dso-env/README.md b/charts/dso-env/README.md index 5e69f7e..1dc9349 100644 --- a/charts/dso-env/README.md +++ b/charts/dso-env/README.md @@ -1,25 +1,32 @@ # dso-env -![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) Creates argocd Project and Applications to deploy DSO project repositories. +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| this-is-tobi | | | + ## Values | Key | Type | Default | Description | |-----|------|---------|-------------| -| application.destination.name | string | `""` | Nom du cluster applicatif cible | +| application.destination.name | string | `"dest"` | Nom du cluster applicatif cible | | application.destination.namespace | string | `"app1"` | Nom du namespace applicatif cible | -| application.repositories | list | `[{"path":".","repoURL":"https://gitlab.com/projects/org/demo/quota-explorer.git","targetRevision":"main"}]` | Liste des dépôts à déployer | +| application.repositories | list | `[{"name":"quota-explorer","path":".","repoURL":"https://gitlab.com/projects/org/demo/quota-explorer.git","targetRevision":"main"}]` | Liste des dépôts à déployer | | application.sourceReposPrefix | string | `"https://gitlab.com/projects/org/demo"` | Préfixe des dépôts autorisés | | argocd.namespace | string | `"argocd"` | Namespace de création des objets ArgoCD | | argocd.nsChartVersion | string | `"1.0.0"` | Version du Chart dso-ns à utiliser | | argocd.project | string | `"project1"` | Préfixe des projets ArgoCD à créer | -| commonLabels | object | `{}` | Labels appliqués sur les différents objets | +| commonLabels | string | `""` | Labels appliqués sur les différents objets | | environment.roGroup | string | `"/project/environment/RO"` | Nom du groupe à autoriser en lecture seule sur les objets applicatifs (-app) déployés par ArgoCD | | environment.rwGroup | string | `"/project/environment/RW"` | Nom du groupe à autoriser en lecture/écriture sur les objets applicatifs (-app) déployés par ArgoCD | | environment.valueFilePath | string | `"values.yaml"` | Chemin du fichier à utiliser lors de la récupération des values | +| environment.valueFileRepository | string | `"https://gitlab.com/projects/Infra/org/demo/infra.git"` | URL du repo avec le fichier values à utiliser pour cet environnement | | environment.valueFileRevision | string | `"HEAD"` | Revision Git à utiliser lors de la récupération des values | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/dso-env/templates/application-app.yaml b/charts/dso-env/templates/application-app.yaml index a4c7cda..87d31b6 100644 --- a/charts/dso-env/templates/application-app.yaml +++ b/charts/dso-env/templates/application-app.yaml @@ -1,20 +1,27 @@ +{{- range .Values.application.repositories }} --- apiVersion: argoproj.io/v1alpha1 kind: Application metadata: - name: {{ .Values.argocd.project }}-app - namespace: {{ .Values.argocd.namespace }} + name: {{ $.Values.argocd.project }}-app-{{ .name }} + namespace: {{ $.Values.argocd.namespace }} labels: app.kubernetes.io/managed-by: dso-console - {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- if $.Values.commonLabels -}} + {{- $.Values.commonLabels | toYaml | nindent 4 }} + {{- end }} spec: - project: {{ .Values.argocd.project }}-app - sources: {{ .Values.application.repositories | toYaml | nindent 4 }} + project: {{ $.Values.argocd.project }}-app + source: + repoURL: {{ .repoURL }} + targetRevision: {{ .targetRevision }} + path: {{ .path }} destination: - name: {{ .Values.application.destination.name }} - namespace: {{ .Values.application.destination.namespace }} + name: {{ $.Values.application.destination.name }} + namespace: {{ $.Values.application.destination.namespace }} syncPolicy: automated: prune: true selfHeal: true allowEmpty: true +{{- end }} diff --git a/charts/dso-env/templates/application-env.yaml b/charts/dso-env/templates/application-env.yaml index b2c2f81..b201780 100644 --- a/charts/dso-env/templates/application-env.yaml +++ b/charts/dso-env/templates/application-env.yaml @@ -6,7 +6,9 @@ metadata: namespace: {{ .Values.argocd.namespace }} labels: app.kubernetes.io/managed-by: dso-console - {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- if $.Values.commonLabels -}} + {{- $.Values.commonLabels | toYaml | nindent 4 }} + {{- end }} spec: project: {{ .Values.argocd.project }}-env sources: diff --git a/charts/dso-env/templates/project-app.yaml b/charts/dso-env/templates/project-app.yaml index b7c15db..0959514 100644 --- a/charts/dso-env/templates/project-app.yaml +++ b/charts/dso-env/templates/project-app.yaml @@ -3,7 +3,9 @@ kind: AppProject metadata: labels: app.kubernetes.io/managed-by: dso-console - {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- if $.Values.commonLabels -}} + {{- $.Values.commonLabels | toYaml | nindent 4 }} + {{- end }} name: {{ .Values.argocd.project }}-app namespace: {{ .Values.argocd.namespace }} spec: diff --git a/charts/dso-env/templates/project-env.yaml b/charts/dso-env/templates/project-env.yaml index 21c4fd0..ffec521 100644 --- a/charts/dso-env/templates/project-env.yaml +++ b/charts/dso-env/templates/project-env.yaml @@ -3,7 +3,9 @@ kind: AppProject metadata: labels: app.kubernetes.io/managed-by: dso-console - {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- if $.Values.commonLabels -}} + {{- $.Values.commonLabels | toYaml | nindent 4 }} + {{- end }} name: {{ .Values.argocd.project }}-env namespace: {{ .Values.argocd.namespace }} spec: diff --git a/charts/dso-env/values.yaml b/charts/dso-env/values.yaml index e4a973c..104f5ab 100644 --- a/charts/dso-env/values.yaml +++ b/charts/dso-env/values.yaml @@ -1,5 +1,5 @@ # -- Labels appliqués sur les différents objets -commonLabels: {} +commonLabels: "" argocd: # -- Préfixe des projets ArgoCD à créer project: project1 @@ -8,6 +8,8 @@ argocd: # -- Version du Chart dso-ns à utiliser nsChartVersion: 1.0.0 environment: + # -- URL du repo avec le fichier values à utiliser pour cet environnement + valueFileRepository: https://gitlab.com/projects/Infra/org/demo/infra.git # -- Revision Git à utiliser lors de la récupération des values valueFileRevision: HEAD # -- Chemin du fichier à utiliser lors de la récupération des values @@ -21,11 +23,12 @@ application: sourceReposPrefix: https://gitlab.com/projects/org/demo destination: # -- Nom du cluster applicatif cible - name: "" + name: dest # -- Nom du namespace applicatif cible namespace: app1 # -- Liste des dépôts à déployer repositories: - - repoURL: https://gitlab.com/projects/org/demo/quota-explorer.git + - name: quota-explorer + repoURL: https://gitlab.com/projects/org/demo/quota-explorer.git targetRevision: main path: '.' diff --git a/charts/dso-ns/Chart.yaml b/charts/dso-ns/Chart.yaml index fa25aa2..c60ecc8 100644 --- a/charts/dso-ns/Chart.yaml +++ b/charts/dso-ns/Chart.yaml @@ -1,5 +1,9 @@ apiVersion: v2 name: dso-ns description: A Helm chart to create all the necessary resources for deploying applications by the DSO console (namespace, secrets, quota, ...). -version: 1.0.0 +version: 1.0.1 appVersion: 1.0.0 +maintainers: + - name: this-is-tobi + email: thibault.colin@interieur.gouv.fr + url: https://this-is-tobi.com diff --git a/charts/dso-ns/README.md b/charts/dso-ns/README.md index 310423b..ab400ff 100644 --- a/charts/dso-ns/README.md +++ b/charts/dso-ns/README.md @@ -1,9 +1,15 @@ # dso-ns -![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) A Helm chart to create all the necessary resources for deploying applications by the DSO console (namespace, secrets, quota, ...). +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| this-is-tobi | | | + ## Values | Key | Type | Default | Description | @@ -14,4 +20,4 @@ A Helm chart to create all the necessary resources for deploying applications by | commonLabels | object | `{}` | Labels appliqués sur les différents objets | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/dso-ns/templates/ns.yaml b/charts/dso-ns/templates/ns.yaml index cc20346..80575b6 100644 --- a/charts/dso-ns/templates/ns.yaml +++ b/charts/dso-ns/templates/ns.yaml @@ -4,4 +4,6 @@ metadata: name: {{ .Values.application.destination.namespace }} labels: app.kubernetes.io/managed-by: dso-console + {{- if .Values.commonLabels }} {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- end }} diff --git a/charts/dso-ns/templates/quota.yaml b/charts/dso-ns/templates/quota.yaml index e6cadd8..2ffaf47 100644 --- a/charts/dso-ns/templates/quota.yaml +++ b/charts/dso-ns/templates/quota.yaml @@ -5,11 +5,12 @@ metadata: namespace: {{ .Values.application.destination.namespace }} labels: app.kubernetes.io/managed-by: dso-console + {{- if .Values.commonLabels }} {{- .Values.commonLabels | toYaml | nindent 4 }} + {{- end }} spec: hard: limits.cpu: {{ .Values.application.quota.cpu | quote }} limits.memory: {{ .Values.application.quota.memory }} requests.cpu: {{ .Values.application.quota.cpu | quote }} requests.memory: {{ .Values.application.quota.memory }} - diff --git a/charts/dso-ns/values.yaml b/charts/dso-ns/values.yaml index 5fcba2a..85bacbb 100644 --- a/charts/dso-ns/values.yaml +++ b/charts/dso-ns/values.yaml @@ -9,4 +9,3 @@ application: cpu: # -- Quota mémoire pour le namespace memory: -