Files
homelab/k8s/argocd/templates/app-self.yaml
T
2023-04-15 02:46:32 +00:00

84 lines
2.2 KiB
YAML

---
{{ $currentScope := .}}
{{- $appvalues := dict -}}
{{ range $path, $_ := .Files.Glob "values/shared/**.yaml" }}
{{- with $currentScope }}
{{ $newobj := .Files.Get $path | fromYaml }}
{{ $appvalues := mergeOverwrite $appvalues $newobj }}
{{- end -}}
{{ end }}
{{- $deploymentPath := printf "values/%s/**.yaml" .Values.selfapp.deployment -}}
{{ range $path, $_ := .Files.Glob $deploymentPath }}
{{- with $currentScope }}
{{ $newobj := .Files.Get $path | fromYaml }}
{{ $appvalues := mergeOverwrite $appvalues $newobj }}
{{- end -}}
{{ end }}
---
apiVersion: v1
kind: Secret
metadata:
name: argo-repo-main
namespace: "{{ .Release.Namespace }}"
labels:
argocd.argoproj.io/secret-type: repository
annotations:
link.argocd.argoproj.io/external-link: "https://github.com/{{ $appvalues.gitops.repo }}"
stringData:
type: git
url: "git@github.com:{{ $appvalues.gitops.repo }}.git"
sshPrivateKey: {{ .Values.selfapp.sshkey | quote }}
{{ if .Values.selfapp.enabled }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
repoURL: "git@github.com:{{ $appvalues.gitops.repo }}.git"
targetRevision: "{{ $appvalues.gitops.commit }}"
path: k8s/argocd
helm:
valueFiles:
- values.yaml
parameters:
- name: "selfapp.deployment"
value: {{ .Values.selfapp.deployment | quote }}
- name: "selfapp.enabled"
value: "true"
- name: "selfapp.sshkey"
value: {{ .Values.selfapp.sshkey | quote }}
destination:
server: https://kubernetes.default.svc
namespace: "{{ .Release.Namespace }}"
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "argoapps"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
repoURL: "git@github.com:{{ $appvalues.gitops.repo }}.git"
targetRevision: "{{ $appvalues.gitops.commit }}"
path: k8s/argoapps
helm:
valueFiles:
- values.yaml
values: |-
{{- $appvalues | toYaml | nindent 8 }}
destination:
server: https://kubernetes.default.svc
namespace: "{{ .Release.Namespace }}"
{{- end -}}