feat(base): own repo management for easy branch managment
This commit is contained in:
parent
e1cdb09953
commit
030caf43aa
7 changed files with 130 additions and 23 deletions
|
@ -1,3 +1,19 @@
|
||||||
|
base:
|
||||||
|
helm:
|
||||||
|
release:
|
||||||
|
install:
|
||||||
|
disableWait: true
|
||||||
|
remediation:
|
||||||
|
retries: -1
|
||||||
|
crds: CreateReplace
|
||||||
|
upgrade:
|
||||||
|
disableWait: true
|
||||||
|
remediation:
|
||||||
|
retries: -1
|
||||||
|
crds: CreateReplace
|
||||||
|
driftDetection:
|
||||||
|
mode: enabled
|
||||||
|
|
||||||
commons:
|
commons:
|
||||||
helm:
|
helm:
|
||||||
release:
|
release:
|
||||||
|
|
|
@ -6,4 +6,4 @@ maintainers:
|
||||||
- name: WrenIX
|
- name: WrenIX
|
||||||
url: https://wrenix.eu
|
url: https://wrenix.eu
|
||||||
|
|
||||||
version: 0.1.0
|
version: 0.2.0
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
commons:
|
base:
|
||||||
namespace:
|
namespace:
|
||||||
labels:
|
labels:
|
||||||
common-label: "default"
|
common-label: "default"
|
||||||
|
|
||||||
helm:
|
helm:
|
||||||
chart:
|
release:
|
||||||
sourceRef:
|
valuesFrom:
|
||||||
kind: GitRepository
|
- name: a
|
||||||
name: wrenix-flux-charts
|
|
||||||
namespace: flux-system
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
test-default-namespace:
|
test-default-namespace:
|
||||||
|
|
|
@ -15,7 +15,7 @@ kind: Namespace
|
||||||
metadata:
|
metadata:
|
||||||
name: "{{ $config.namespace.name }}"
|
name: "{{ $config.namespace.name }}"
|
||||||
labels:
|
labels:
|
||||||
{{- $config.namespace.labels | default (dict) | mergeOverwrite $.Values.commons.namespace.labels | toYaml | nindent 4 }}
|
{{- $config.namespace.labels | default (dict) | mergeOverwrite $.Values.base.namespace.labels | toYaml | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
|
@ -10,27 +10,41 @@ spec:
|
||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
sourceRef:
|
sourceRef:
|
||||||
{{- toYaml $.Values.commons.helm.chart.sourceRef | nindent 8 }}
|
kind: "GitRepository"
|
||||||
|
{{- with $.Values.base.helm.repo.namespace }}
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- if $config.branch }}
|
||||||
|
name: "{{ $.Release.Namespace }}-{{ $.Release.Name }}-{{ $componentInstance }}"
|
||||||
|
{{- else }}
|
||||||
|
name: "{{ $.Release.Namespace }}-{{ $.Release.Name }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if $config.branch }}
|
||||||
|
name: "{{ $.Release.Name }}-{{ $componentInstance }}"
|
||||||
|
{{- else }}
|
||||||
|
name: "{{ $.Release.Name }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
chart: "./{{ $componentName }}"
|
chart: "./{{ $componentName }}"
|
||||||
reconcileStrategy: "Revision"
|
reconcileStrategy: "Revision"
|
||||||
releaseName: "{{ printf "%s-%s" $.Release.Name $componentInstance | replace (printf "%s-%s" $.Release.Name $.Release.Name) $.Release.Name }}"
|
releaseName: "{{ printf "%s-%s" $.Release.Name $componentInstance | replace (printf "%s-%s" $.Release.Name $.Release.Name) $.Release.Name }}"
|
||||||
targetNamespace: "{{ ($config.namespace | default (dict)).name | default (dict) | default $.Release.Namespace }}"
|
targetNamespace: "{{ ($config.namespace | default (dict)).name | default (dict) | default $.Release.Namespace }}"
|
||||||
install:
|
install:
|
||||||
{{- toYaml $.Values.commons.helm.release.install | nindent 4 }}
|
{{- toYaml $.Values.base.helm.release.install | nindent 4 }}
|
||||||
test:
|
test:
|
||||||
{{- toYaml $.Values.commons.helm.release.test | nindent 4 }}
|
{{- toYaml $.Values.base.helm.release.test | nindent 4 }}
|
||||||
upgrade:
|
upgrade:
|
||||||
{{- toYaml $.Values.commons.helm.release.upgrade | nindent 4 }}
|
{{- toYaml $.Values.base.helm.release.upgrade | nindent 4 }}
|
||||||
driftDetection:
|
driftDetection:
|
||||||
{{- toYaml $.Values.commons.helm.release.driftDetection | nindent 4 }}
|
{{- toYaml $.Values.base.helm.release.driftDetection | nindent 4 }}
|
||||||
interval: {{ $.Values.componentCommons.helm.release.interval }}
|
interval: {{ $.Values.base.helm.release.interval }}
|
||||||
valuesFrom:
|
valuesFrom:
|
||||||
- kind: ConfigMap
|
- kind: ConfigMap
|
||||||
name: "{{ $.Release.Name }}-{{ $componentInstance }}-init"
|
name: "{{ $.Release.Name }}-{{ $componentInstance }}-init"
|
||||||
optional: true
|
optional: true
|
||||||
valuesKey: init
|
valuesKey: init
|
||||||
targetPath: init.version
|
targetPath: init.version
|
||||||
{{- with $.Values.componentCommons.helm.release.valuesFrom }}
|
{{- with $.Values.base.helm.release.valuesFrom }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with $config.valuesFrom }}
|
{{- with $config.valuesFrom }}
|
||||||
|
|
58
base/templates/repo.yaml
Normal file
58
base/templates/repo.yaml
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
---
|
||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: GitRepository
|
||||||
|
metadata:
|
||||||
|
{{- with .Values.base.helm.repo.namespace }}
|
||||||
|
name: "{{ $.Release.Namespace }}-{{ $.Release.Name }}"
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- else }}
|
||||||
|
name: "{{ $.Release.Name }}"
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
url: {{ .Values.base.helm.repo.url | quote }}
|
||||||
|
ref:
|
||||||
|
{{- toYaml .Values.base.helm.repo.ref | nindent 4 }}
|
||||||
|
{{- with .Values.base.helm.repo.secretRef }}
|
||||||
|
secretRef:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.base.helm.repo.verify }}
|
||||||
|
verify:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
interval: {{ .Values.base.helm.repo.interval }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
|
||||||
|
if branch is set
|
||||||
|
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{- range $componentInstance, $config := .Values.components }}
|
||||||
|
{{- if and $config.enabled $config.branch }}
|
||||||
|
---
|
||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: GitRepository
|
||||||
|
metadata:
|
||||||
|
{{- with $.Values.base.helm.repo.namespace }}
|
||||||
|
name: "{{ $.Release.Namespace }}-{{ $.Release.Name }}-{{ $componentInstance }}"
|
||||||
|
namespace: {{ . }}
|
||||||
|
{{- else }}
|
||||||
|
name: "{{ $.Release.Name }}-{{ $componentInstance }}"
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
url: {{ $.Values.base.helm.repo.url | quote }}
|
||||||
|
ref:
|
||||||
|
branch: {{ $config.branch | quote }}
|
||||||
|
{{- with $.Values.base.helm.repo.secretRef }}
|
||||||
|
secretRef:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
interval: 1m
|
||||||
|
{{- with $.Values.base.helm.repo.verify }}
|
||||||
|
verify:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
interval: {{ $.Values.base.helm.repo.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -1,24 +1,46 @@
|
||||||
global: {}
|
##
|
||||||
|
# configuration of this helm-chart
|
||||||
|
##
|
||||||
|
|
||||||
commons:
|
base:
|
||||||
namespace:
|
namespace:
|
||||||
# -- labels for every new created namespace (together or overwritten by components.<component-release-name.namespace.labels)
|
# -- labels for every new created namespace (together or overwritten by components.<component-release-name.namespace.labels)
|
||||||
labels: {}
|
labels: {}
|
||||||
|
|
||||||
helm:
|
helm:
|
||||||
|
repo:
|
||||||
|
# -- git repo where all components are stored
|
||||||
|
url: https://codeberg.org/wrenix/flux-charts.git
|
||||||
|
# -- namespace, where the GitRepo resource is installed (maybe needed together with secretRef)
|
||||||
|
namespace:
|
||||||
|
# -- default ref (if no branch is set - maybe overwritten by semver or so)
|
||||||
|
ref:
|
||||||
|
branch: main
|
||||||
|
# -- secret to get access to the git-repo
|
||||||
|
secretRef:
|
||||||
|
# -- secret to get access to the git-repo
|
||||||
|
verify:
|
||||||
|
interval: 10m
|
||||||
release:
|
release:
|
||||||
|
interval: 10m
|
||||||
install: {}
|
install: {}
|
||||||
test: {}
|
test: {}
|
||||||
upgrade: {}
|
upgrade: {}
|
||||||
driftDetection: {}
|
driftDetection: {}
|
||||||
|
|
||||||
componentCommons:
|
|
||||||
helm:
|
|
||||||
release:
|
|
||||||
interval: 10m
|
|
||||||
# -- valuesFrom for every components (for use values from ConfigMap or Secret)
|
# -- valuesFrom for every components (for use values from ConfigMap or Secret)
|
||||||
valuesFrom: []
|
valuesFrom: []
|
||||||
|
|
||||||
|
##
|
||||||
|
# Shared Values
|
||||||
|
# between all components
|
||||||
|
##
|
||||||
|
global: {}
|
||||||
|
commons: {}
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# Components
|
||||||
|
##
|
||||||
components:
|
components:
|
||||||
<component-release-name>:
|
<component-release-name>:
|
||||||
# -- enable component-release to install
|
# -- enable component-release to install
|
||||||
|
|
Loading…
Add table
Reference in a new issue