L'app url-shortener était en SyncError permanent : son PVC live porte un spec.volumeName épinglé (rebind du volume Longhorn après le drill coupure de courant) absent du chart ; chaque sync tentait donc de le vider, refus API (spec immuable après création), échec en boucle malgré automated+selfHeal. - apps.yaml : passthrough générique ignoreDifferences + syncOptions par app. - values.yaml : url-shortener ignore /spec/volumeName du PVC, avec RespectIgnoreDifferences=true pour que l'apply réinjecte la valeur live au lieu de la vider (le cas d'usage documenté d'ArgoCD pour les champs immuables). Rendu helm vérifié : seule l'Application url-shortener change. Co-Authored-By: Claude Fable 5 <[email protected]>
92 lines
2.7 KiB
YAML
92 lines
2.7 KiB
YAML
{{- range $app_name, $app_attr := .Values.gitea_applications -}}
|
|
{{- $org := default "arcodange-org" $app_attr.org -}}
|
|
{{- /* Namespace defaults to the app name; override lets siblings share one
|
|
(e.g. kadans-jobs deploys into the `kadans` namespace). */ -}}
|
|
{{- $ns := default $app_name $app_attr.namespace -}}
|
|
---
|
|
apiVersion: argoproj.io/v1alpha1
|
|
kind: Application
|
|
metadata:
|
|
name: {{ $app_name }}
|
|
namespace: argocd
|
|
finalizers:
|
|
- resources-finalizer.argocd.argoproj.io
|
|
{{- with $app_attr.annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
project: default
|
|
source:
|
|
repoURL: https://gitea.arcodange.lab/{{ $org }}/{{ $app_name }}
|
|
targetRevision: HEAD
|
|
path: chart
|
|
destination:
|
|
server: https://kubernetes.default.svc
|
|
namespace: {{ $ns }}
|
|
{{- /* Champs à exclure du diff (ex: /spec/volumeName d'un PVC rebindé à la
|
|
main après le drill coupure de courant — immuable côté API). À coupler
|
|
avec la syncOption RespectIgnoreDifferences=true pour que l'apply
|
|
réinjecte la valeur live au lieu de tenter de la vider. */}}
|
|
{{- with $app_attr.ignoreDifferences }}
|
|
ignoreDifferences:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
syncPolicy:
|
|
{{- if $app_attr.syncPolicy }}
|
|
{{- toYaml $app_attr.syncPolicy | nindent 4 }}
|
|
{{- else }}
|
|
automated:
|
|
prune: true
|
|
selfHeal: true
|
|
{{- end }}
|
|
syncOptions:
|
|
- CreateNamespace=true
|
|
{{- range $app_attr.syncOptions }}
|
|
- {{ . }}
|
|
{{- end }}
|
|
{{- /*
|
|
Non-prod environments (ADR-0002 elision rule): one extra Application per env
|
|
under `<app_attr>.envs`. Each renders the SAME repo + chart, overlaid with
|
|
values-<env>.yaml, into the `<app>-<env>` namespace. Apps with no `envs` key
|
|
render nothing extra here, so prod-only apps are byte-identical.
|
|
*/ -}}
|
|
{{- range $env_name, $env_attr := $app_attr.envs }}
|
|
---
|
|
apiVersion: argoproj.io/v1alpha1
|
|
kind: Application
|
|
metadata:
|
|
name: {{ $app_name }}-{{ $env_name }}
|
|
namespace: argocd
|
|
finalizers:
|
|
- resources-finalizer.argocd.argoproj.io
|
|
{{- with $env_attr.annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
project: default
|
|
source:
|
|
repoURL: https://gitea.arcodange.lab/{{ $org }}/{{ $app_name }}
|
|
targetRevision: HEAD
|
|
path: chart
|
|
helm:
|
|
valueFiles:
|
|
- values.yaml
|
|
- values-{{ $env_name }}.yaml
|
|
destination:
|
|
server: https://kubernetes.default.svc
|
|
namespace: {{ $app_name }}-{{ $env_name }}
|
|
syncPolicy:
|
|
{{- if $env_attr.syncPolicy }}
|
|
{{- toYaml $env_attr.syncPolicy | nindent 4 }}
|
|
{{- else }}
|
|
automated:
|
|
prune: true
|
|
selfHeal: true
|
|
{{- end }}
|
|
syncOptions:
|
|
- CreateNamespace=true
|
|
{{- end }}
|
|
{{ end }}
|