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 apiVersion: v2
name: cluster_setup name: cluster_setup
version: 0.3.2 version: 0.3.3
type: application type: application
description: "Initial cluster setup" description: "Initial cluster setup"
maintainers: maintainers:
@@ -8,8 +8,8 @@ maintainers:
url: https://2martens.de url: https://2martens.de
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- kind: changed - kind: fixed
description: Create namespace if thanos is enabled description: Added missing labels and annotations
artifacthub.io/signKey: | artifacthub.io/signKey: |
fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8
url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc 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 kind: ClusterIssuer
metadata: metadata:
name: lets-encrypt name: lets-encrypt
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
spec: spec:
acme: acme:
email: {{ .Values.email }} email: {{ .Values.email }}
@@ -3,12 +3,20 @@ apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: {{ .Values.hcloud.namespace | default "hcloud" }} name: {{ .Values.hcloud.namespace | default "hcloud" }}
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
type: Opaque type: Opaque
metadata: metadata:
name: hcloud name: hcloud
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
data: data:
token: {{ .Values.hcloud.token | b64enc }} token: {{ .Values.hcloud.token | b64enc }}
{{- end }} {{- end }}
@@ -3,12 +3,20 @@ apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: {{ .Values.thanos.namespace | default "observability" }} name: {{ .Values.thanos.namespace | default "observability" }}
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
namespace: {{ .Values.thanos.namespace | default "observability" }} namespace: {{ .Values.thanos.namespace | default "observability" }}
name: thanos-object-storage-config name: thanos-object-storage-config
labels:
{{- include "template.labels" . | nindent 4 }}
annotations:
{{- include "template.annotations" . | nindent 4 }}
data: data:
thanos.yaml: |- thanos.yaml: |-
{{ tpl (.Files.Get "thanos.yaml") . | b64enc }} {{ tpl (.Files.Get "thanos.yaml") . | b64enc }}
@@ -5,6 +5,8 @@ apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: {{ .name }} name: {{ .name }}
labels:
{{- include "template.labels" . | nindent 4 }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@@ -12,6 +14,8 @@ type: Opaque
metadata: metadata:
name: vault-service-principal name: vault-service-principal
namespace: {{ .name }} namespace: {{ .name }}
labels:
{{- include "template.labels" . | nindent 4 }}
data: data:
clientID: {{ $.Values.vault.clientId | b64enc }} clientID: {{ $.Values.vault.clientId | b64enc }}
clientSecret: {{ $.Values.vault.clientSecret | b64enc }} clientSecret: {{ $.Values.vault.clientSecret | b64enc }}