Files
homelab/k8s/argoapps/templates/charts-infra.yaml
T
2023-10-24 15:52:49 -04:00

49 lines
1.4 KiB
YAML

---
{{- $infraChartProjectName := "infrastructure-charts" -}}
{{ include "homelab.argo.project" (dict "name" $infraChartProjectName "description" "infrastructure helm charts")}}
{{ range $chartName, $chartProps := .Values.infrastructureCharts }}
{{- $namespace := $chartProps.namespace | default (printf "chart-%s" $chartName) -}}
{{ if (not $chartProps.namespace) }}
---
apiVersion: v1
kind: Namespace
metadata:
name: "{{ $namespace }}"
{{ end }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: chart-{{ $chartName }}
spec:
project: {{ $infraChartProjectName }}
source:
chart: {{ $chartProps.chart | default $chartName }}
repoURL: {{ $chartProps.repoURL }}
targetRevision: {{ $chartProps.targetRevision }}
helm:
values: |-
{{- $values := ($chartProps.values | default "") -}}
{{ if $chartProps.valuesFile }}
{{- $valuesFilePath := (printf "chart-values/%s" $chartProps.valuesFile) -}}
{{- $values := $.Files.Get $valuesFilePath -}}
{{- tpl $values $ | nindent 8 }}
{{ else }}
{{- tpl $values $ | nindent 8 }}
{{ end }}
releaseName: {{ $chartName }}
destination:
server: https://kubernetes.default.svc
namespace: {{ $namespace }}
syncPolicy:
automated:
selfHeal: true
{{ if $chartProps.enableServerSideApply}}
syncOptions:
- ServerSideApply=true
{{ end }}
{{ end }}