Refactor argo apps factory
This commit is contained in:
parent
715e1d6c69
commit
123d7ce946
@ -2,7 +2,7 @@ apiVersion: v2
|
||||
name: kubezero
|
||||
description: KubeZero ArgoCD Application - Root App of Apps chart of KubeZero
|
||||
type: application
|
||||
version: 0.4.4
|
||||
version: 0.4.5
|
||||
home: https://kubezero.com
|
||||
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
|
||||
keywords:
|
||||
|
37
charts/kubezero/templates/_app.tpl
Normal file
37
charts/kubezero/templates/_app.tpl
Normal file
@ -0,0 +1,37 @@
|
||||
{{- define "kubezero-app.app" }}
|
||||
{{- $name := regexReplaceAll "kubezero/templates/([a-z-]*)..*" .Template.Name "${1}" }}
|
||||
{{- $my_values := index .Values $name "values" }}
|
||||
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
namespace: argocd
|
||||
labels:
|
||||
{{ include "kubezero-lib.labels" . | indent 4 }}
|
||||
{{- if not ( index .Values $name "retain" ) }}
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
{{- end }}
|
||||
spec:
|
||||
project: kubezero
|
||||
|
||||
source:
|
||||
repoURL: {{ .Values.global.defaultSource.repoURL }}
|
||||
targetRevision: {{ .Values.global.defaultSource.targetRevision }}
|
||||
path: {{ .Values.global.defaultSource.pathPrefix}}charts/kubezero-{{ $name }}
|
||||
{{- if $my_values }}
|
||||
helm:
|
||||
values: |
|
||||
{{- toYaml $my_values | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
destination:
|
||||
server: {{ .Values.global.defaultDestination.server }}
|
||||
namespace: {{ default "kube-system" ( index .Values $name "namespace" ) }}
|
||||
|
||||
{{- if .Values.global.syncPolicy }}
|
||||
syncPolicy:
|
||||
{{- toYaml .Values.global.syncPolicy | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -1,39 +0,0 @@
|
||||
{{- define "kubezero-app.app" }}
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: {{ .name | lower }}
|
||||
namespace: argocd
|
||||
labels:
|
||||
{{ include "kubezero-lib.labels" .root | indent 4 }}
|
||||
{{- if not .retain }}
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
{{- end }}
|
||||
spec:
|
||||
project: kubezero
|
||||
|
||||
source:
|
||||
repoURL: {{ .root.Values.global.defaultSource.repoURL }}
|
||||
targetRevision: {{ .root.Values.global.defaultSource.targetRevision }}
|
||||
{{- if eq .type "helm" }}
|
||||
{{- $my_values := index .root.Values .name "values" }}
|
||||
path: {{ .root.Values.global.defaultSource.pathPrefix}}charts/kubezero-{{ .name }}
|
||||
{{- if $my_values }}
|
||||
helm:
|
||||
values: |
|
||||
{{- toYaml $my_values | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
path: {{ .root.Values.global.defaultSource.pathPrefix }}artifacts/kubezero-{{ .name }}
|
||||
{{- end }}
|
||||
|
||||
destination:
|
||||
server: {{ .root.Values.global.defaultDestination.server }}
|
||||
namespace: {{ default "kube-system" .namespace }}
|
||||
|
||||
{{- if .root.Values.global.syncPolicy }}
|
||||
syncPolicy:
|
||||
{{- toYaml .root.Values.global.syncPolicy | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -1,3 +1,3 @@
|
||||
{{- if index .Values "aws-ebs-csi-driver" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "aws-ebs-csi-driver" "type" "helm" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
{{- end }}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{{- if index .Values "aws-efs-csi-driver" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "aws-efs-csi-driver" "type" "helm" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
{{- end }}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if .Values.calico.enabled }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "calico" "type" "helm" "retain" true }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
|
||||
ignoreDifferences:
|
||||
- group: apiextensions.k8s.io
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if index .Values "cert-manager" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "cert-manager" "type" "helm" "namespace" "cert-manager" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if .Values.istio.enabled }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "istio" "type" "helm" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
|
||||
ignoreDifferences:
|
||||
- group: apiextensions.k8s.io
|
||||
|
@ -1,3 +1,3 @@
|
||||
{{- if index .Values "kiam" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "kiam" "type" "helm" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
{{- end }}
|
||||
|
@ -1,3 +1,3 @@
|
||||
{{- if index .Values "local-volume-provisioner" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "local-volume-provisioner" "type" "helm" }}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
{{- end }}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if index .Values "logging" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "logging" "type" "helm" "namespace" "logging"}}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
|
||||
ignoreDifferences:
|
||||
- group: admissionregistration.k8s.io
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if index .Values "metrics" "enabled" }}
|
||||
{{ template "kubezero-app.app" dict "root" . "name" "metrics" "type" "helm" "namespace" "monitoring"}}
|
||||
{{ include "kubezero-app.app" . }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
|
@ -17,9 +17,11 @@ platform: aws
|
||||
|
||||
calico:
|
||||
enabled: false
|
||||
retain: true
|
||||
|
||||
cert-manager:
|
||||
enabled: false
|
||||
namespace: cert-manager
|
||||
|
||||
local-volume-provisioner:
|
||||
enabled: false
|
||||
@ -38,6 +40,8 @@ istio:
|
||||
|
||||
metrics:
|
||||
enabled: false
|
||||
namespace: monitoring
|
||||
|
||||
logging:
|
||||
enabled: false
|
||||
namespace: logging
|
||||
|
Loading…
Reference in New Issue
Block a user