Added missing labels/annotations

This commit is contained in:
2023-11-07 09:39:37 +01:00
parent ab6a0e1de1
commit 507cca0fb9
6 changed files with 104 additions and 3 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
apiVersion: v2
name: cluster_setup
version: 0.3.2
version: 0.3.3
type: application
description: "Initial cluster setup"
maintainers:
@@ -8,8 +8,8 @@ maintainers:
url: https://2martens.de
annotations:
artifacthub.io/changes: |
- kind: changed
description: Create namespace if thanos is enabled
- kind: fixed
description: Added missing labels and annotations
artifacthub.io/signKey: |
fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8
url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc
+77
View File
@@ -0,0 +1,77 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "template.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "template.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "template.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "template.labels" -}}
helm.sh/chart: {{ include "template.chart" . }}
{{ include "template.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "template.annotations" -}}
meta.helm.sh/release-name: {{ .Release.Name }}
meta.helm.sh/release-namespace: {{ .Release.Namespace }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "template.selectorLabels" -}}
app.kubernetes.io/name: {{ include "template.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "template.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "template.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{- /*
template.util.merge will merge two YAML templates and output the result.
This takes an array of three values:
- the top context
- the template name of the overrides (destination)
- the template name of the base (source)
*/}}
{{- define "template.util.merge" -}}
{{- $top := first . -}}
{{- $overrides := fromYaml (include (index . 1) $top) | default (dict ) -}}
{{- $tpl := fromYaml (include (index . 2) $top) | default (dict ) -}}
{{- toYaml (merge $overrides $tpl) -}}
{{- end -}}
@@ -2,6 +2,10 @@ apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: lets-encrypt
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
spec:
acme:
email: {{ .Values.email }}
@@ -3,12 +3,20 @@ apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.hcloud.namespace | default "hcloud" }}
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: hcloud
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
data:
token: {{ .Values.hcloud.token | b64enc }}
{{- end }}
@@ -3,12 +3,20 @@ apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.thanos.namespace | default "observability" }}
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
---
apiVersion: v1
kind: Secret
metadata:
namespace: {{ .Values.thanos.namespace | default "observability" }}
name: thanos-object-storage-config
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
data:
thanos.yaml: |-
{{ tpl (.Files.Get "thanos.yaml") . | b64enc }}
@@ -5,6 +5,8 @@ apiVersion: v1
kind: Namespace
metadata:
name: {{ .name }}
labels:
{{- include "template.labels" . | nindent 4 }}
---
apiVersion: v1
kind: Secret
@@ -12,6 +14,8 @@ type: Opaque
metadata:
name: vault-service-principal
namespace: {{ .name }}
labels:
{{- include "template.labels" . | nindent 4 }}
data:
clientID: {{ $.Values.vault.clientId | b64enc }}
clientSecret: {{ $.Values.vault.clientSecret | b64enc }}