From d2040479795d3560cd2032f7686492d9b2b52bcf Mon Sep 17 00:00:00 2001 From: Adrien Bouvais Date: Fri, 14 Aug 2026 16:01:42 +0200 Subject: [PATCH] Add gitops --- gitops/root-app.yaml | 20 ++++++++++++++++++++ gitops/tenants-appset.yaml | 37 +++++++++++++++++++++++++++++++++++++ gitops/tenants-project.yaml | 15 +++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 gitops/root-app.yaml create mode 100644 gitops/tenants-appset.yaml create mode 100644 gitops/tenants-project.yaml diff --git a/gitops/root-app.yaml b/gitops/root-app.yaml new file mode 100644 index 0000000..15fa215 --- /dev/null +++ b/gitops/root-app.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: root + namespace: argocd +spec: + project: default + source: + repoURL: https://git.bouvais.lu/adrien/ctie-exercice + targetRevision: main + path: gitops + directory: + recurse: true + destination: + server: https://kubernetes.default.svc + namespace: argocd + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/gitops/tenants-appset.yaml b/gitops/tenants-appset.yaml new file mode 100644 index 0000000..16bc392 --- /dev/null +++ b/gitops/tenants-appset.yaml @@ -0,0 +1,37 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: tenants + namespace: argocd +spec: + goTemplate: true + generators: + - git: + repoURL: https://git.bouvais.lu/adrien/ctie-exercice + revision: main + files: + - path: "tenants/*/config.yaml" + template: + metadata: + name: 'tenant-{{.name}}' + spec: + project: tenants + sources: + - repoURL: https://git.bouvais.lu/adrien/ctie-exercice + targetRevision: main + path: charts/tenant + helm: + valueFiles: + - '$values/tenants/{{.name}}/config.yaml' + - repoURL: https://git.bouvais.lu/adrien/ctie-exercice + targetRevision: main + ref: values + destination: + server: https://kubernetes.default.svc + namespace: 'tenant-{{.name}}' + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/gitops/tenants-project.yaml b/gitops/tenants-project.yaml new file mode 100644 index 0000000..8f2dded --- /dev/null +++ b/gitops/tenants-project.yaml @@ -0,0 +1,15 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: tenants + namespace: argocd +spec: + sourceRepos: + - https://git.bouvais.lu/adrien/ctie-exercice + destinations: + - server: https://kubernetes.default.svc + namespace: 'tenant-*' + clusterResourceWhitelist: [] # tenants can't touch cluster-scoped resources + namespaceResourceWhitelist: + - group: '*' + kind: '*'