wip: helm

This commit is contained in:
cyrilix authored and Cyrille Nofficial committed 2022-09-12 16:34:34 +02:00
1 parent ebc15cb394
commit 5cab1cd96d
9 files changed
+296

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "pod-cleaner.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 "pod-cleaner.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 "pod-cleaner.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "pod-cleaner.labels" -}}
app: {{ .Chart.Name }}
helm.sh/chart: {{ include "pod-cleaner.chart" . }}
{{ include "pod-cleaner.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "pod-cleaner.selectorLabels" -}}
app.kubernetes.io/name: {{ include "pod-cleaner.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "pod-cleaner.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "pod-cleaner.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "pod-cleaner.fullname" . }}
labels:
{{- include "pod-cleaner.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "pod-cleaner.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "pod-cleaner.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "pod-cleaner.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "--metric-path=/metrics"
- "--metric-port=0.0.0.0:{{ .Values.service.port }}"
- "--log-file={{ .Values.podCleaner.logfile }}"
- "--log={{ .Values.podCleaner.logLevel }}"
ports:
- name: http-metric
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /metrics
port: http-metric
readinessProbe:
httpGet:
path: /metrics
port: http-metric
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
View File
Whitespace-only changes.
+18
View File
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "pod-cleaner.fullname" . }}
labels:
{{- include "pod-cleaner.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http-metric
protocol: TCP
name: http-metric
{{- if semverCompare ">= 1.24-0" .Capabilities.KubeVersion.Version }}
appProtocol: http
{{- end }}
selector:
{{- include "pod-cleaner.selectorLabels" . | nindent 4 }}
+12
View File
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "pod-cleaner.serviceAccountName" . }}
labels:
{{- include "pod-cleaner.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}