108 lines
3.5 KiB
YAML
108 lines
3.5 KiB
YAML
apiVersion: argoproj.io/v1alpha1
|
|
kind: ApplicationSet
|
|
metadata:
|
|
name: apps
|
|
namespace: argocd
|
|
spec:
|
|
goTemplate: true
|
|
goTemplateOptions: ["missingkey=error"]
|
|
generators:
|
|
- merge:
|
|
# Join base (directories) with overrides (files) by folder name:
|
|
mergeKeys:
|
|
- '{{ .path.basename }}' # requires recent Argo CD (see note)
|
|
generators:
|
|
# Base: every folder under apps/*
|
|
- git:
|
|
repoURL: https://git.mvzijl.nl/marco/veda.git
|
|
revision: HEAD
|
|
branch: applicationset-rewrite
|
|
directories:
|
|
- path: apps/*
|
|
# Overrides: optional appset.(yaml|yml|json) in each app
|
|
- git:
|
|
repoURL: https://git.mvzijl.nl/marco/veda.git
|
|
revision: HEAD
|
|
branch: applicationset-rewrite
|
|
files:
|
|
- path: apps/*/appset.yaml
|
|
- path: apps/*/appset.yml
|
|
- path: apps/*/appset.json
|
|
# ---- Application template ----
|
|
template:
|
|
metadata:
|
|
name: '{{ default .path.basename .name }}'
|
|
labels:
|
|
app.kubernetes.io/part-of: root
|
|
# allow grouping for RollingSync (see section B)
|
|
tier: '{{ default "apps" (index .labels "tier") }}'
|
|
finalizers:
|
|
- resources-finalizer.argocd.argoproj.io
|
|
spec:
|
|
project: '{{ default "default" .project }}'
|
|
source:
|
|
repoURL: https://git.mvzijl.nl/marco/veda.git
|
|
branch: applicationset-rewrite
|
|
targetRevision: '{{ default "main" .targetRevision }}'
|
|
path: '{{ .path.path }}'
|
|
# Tool-specific overrides (only render when present)
|
|
{{- if .helm }}
|
|
helm:
|
|
{{- if .helm.releaseName }}releaseName: {{ .helm.releaseName }}{{- end }}
|
|
{{- if .helm.valueFiles }}
|
|
valueFiles:
|
|
{{- range .helm.valueFiles }}
|
|
- {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if hasKey .helm "ignoreMissingValueFiles" }}
|
|
ignoreMissingValueFiles: {{ .helm.ignoreMissingValueFiles }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .kustomize }}
|
|
kustomize:
|
|
{{- if .kustomize.namePrefix }}namePrefix: {{ .kustomize.namePrefix }}{{- end }}
|
|
{{- if .kustomize.commonLabels }}
|
|
commonLabels:
|
|
{{- range $k,$v := .kustomize.commonLabels }}
|
|
{{ $k }}: {{ $v }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .directory }}
|
|
directory:
|
|
{{- if hasKey .directory "recurse" }}recurse: {{ .directory.recurse }}{{- end }}
|
|
{{- end }}
|
|
destination:
|
|
server: '{{ default "https://kubernetes.default.svc" .server }}'
|
|
namespace: '{{ default .path.basename .namespace }}'
|
|
syncPolicy:
|
|
automated:
|
|
prune: false
|
|
selfHeal: false
|
|
syncOptions:
|
|
- CreateNamespace=true
|
|
- ServerSideApply=true
|
|
{{- range .syncOptions }}
|
|
- {{ . }}
|
|
{{- end }}
|
|
# ---- Progressive / RollingSync (section B) ----
|
|
strategy:
|
|
type: RollingSync
|
|
rollingSync:
|
|
steps:
|
|
- matchExpressions:
|
|
- key: tier
|
|
operator: In
|
|
values: ["system"] # e.g. CRDs/operators first
|
|
- matchExpressions:
|
|
- key: tier
|
|
operator: In
|
|
values: ["platform"] # infra (DBs, ingress, etc.)
|
|
maxUpdate: 50%
|
|
- matchExpressions:
|
|
- key: tier
|
|
operator: In
|
|
values: ["apps"] # leaf apps
|
|
maxUpdate: 25%
|
|
deletionOrder: Reverse |