fix(base): init

This commit is contained in:
WrenIX 2023-11-24 21:31:51 +01:00
parent 2b060de2e5
commit eb597e48c2
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
8 changed files with 135 additions and 0 deletions

22
base-values/commons.yaml Normal file
View file

@ -0,0 +1,22 @@
commons:
helm:
release:
install:
disableWait: true
remediation:
retries: -1
upgrade:
disableWait: true
remediation:
retries: -1
grafana:
dashboards:
labels:
grafana_dashboard: "1"
prometheus:
monitor:
labels:
prometheus: default
rules:
labels:
prometheus: default

10
base-values/infra.yaml Normal file
View file

@ -0,0 +1,10 @@
components:
infra-fluxcd:
enabled: true
namespace: "flux-system"
skip_namespace_create: true
values:
grafana:
dashboards:
annotations:
grafana.mon.local/dashboard-folder: "GitOps"

23
base/.helmignore Normal file
View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

6
base/Chart.yaml Normal file
View file

@ -0,0 +1,6 @@
apiVersion: v2
name: base
description: This is an Helm-Chart which creates an overlaye to connect / install multiple flux-charts / components (and use the helm values for it)
type: application
version: 0.1.0

7
base/ci/ct-values.yaml Normal file
View file

@ -0,0 +1,7 @@
commons:
helm:
chart:
sourceRef:
kind: GitRepository
name: wrenix-flux-charts
namespace: flux-system

View file

@ -0,0 +1,20 @@
{{ $depulicateNamespace := dict }}
{{- range $name, $config := .Values.components }}
{{- if and $config.enabled
$config.namespace
(ne $config.namespace "")
(not (hasKey $depulicateNamespace $config.namespace))
(ne $config.namespace $.Release.Namespace)
(not $config.skip_namespace_create)
}}
{{ $depulicateNamespace = set $depulicateNamespace $config.namespace true }}
---
apiVersion: v1
kind: Namespace
metadata:
name: "{{ $config.namespace }}"
labels:
{{- toYaml $.Values.commons.namespace.labels | nindent 4 }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,34 @@
{{- range $name, $config := .Values.components }}
{{- if $config.enabled }}
{{- $name = $config.name | default $name }}
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: "{{ $.Release.Name }}-{{ $name }}"
spec:
chart:
spec:
sourceRef:
{{- toYaml $.Values.commons.helm.chart.sourceRef | nindent 8 }}
chart: "./{{ $name }}"
reconcileStrategy: "Revision"
releaseName: "{{ $.Release.Name }}-{{ $name }}"
targetNamespace: "{{ $config.namespace | default $.Release.Namespace }}"
install:
{{- toYaml $.Values.commons.helm.release.install | nindent 4 }}
test:
{{- toYaml $.Values.commons.helm.release.test | nindent 4 }}
upgrade:
{{- toYaml $.Values.commons.helm.release.upgrade | nindent 4 }}
interval: 5m
valuesFrom:
- kind: ConfigMap
name: "{{ $.Release.Name }}-{{ $name }}-init"
optional: true
valuesKey: init
targetPath: init.version
values:
{{- $config.values | default (dict) | mergeOverwrite (dict "commons" $.Values.commons "global" $.Values.global) | toYaml | nindent 4 }}
{{- end }}
{{- end }}

13
base/values.yaml Normal file
View file

@ -0,0 +1,13 @@
global: {}
commons:
namespace:
labels: {}
helm:
release:
install: {}
test: {}
upgrade: {}
components: {}