Commit 06fba9a9 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed deployment name

parent d8921d83
Pipeline #5576 failed with stage
in 12 seconds
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "Yacy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | 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 "Yacy.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 }}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trimSuffix "-app" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "Yacy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "appname" -}}
{{- $releaseName := default .Release.Name .Values.releaseOverride -}}
{{- printf "%s" $releaseName | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "Yacy.labels" -}}
app: yacy
helm.sh/chart: {{ include "Yacy.chart" . }}
{{ include "Yacy.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- define "imagename" -}}
{{- if eq .Values.image.tag "" -}}
{{- .Values.image.repository -}}
{{- else -}}
{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}}
{{- end -}}
{{- end -}}
{{- define "trackableappname" -}}
{{- $trackableName := printf "%s-%s" (include "appname" .) .Values.application.track -}}
{{- $trackableName | trimSuffix "-stable" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Selector labels
Get a hostname from URL
*/}}
{{- define "Yacy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "Yacy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "hostname" -}}
{{- . | trimPrefix "http://" | trimPrefix "https://" | trimSuffix "/" | trim | quote -}}
{{- end -}}
{{/*
Create the name of the service account to use
Get SecRule's arguments with unescaped single&double quotes
*/}}
{{- define "Yacy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "Yacy.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- define "secrule" -}}
{{- $operator := .operator | quote | replace "\"" "\\\"" | replace "'" "\\'" -}}
{{- $action := .action | quote | replace "\"" "\\\"" | replace "'" "\\'" -}}
{{- printf "SecRule %s %s %s" .variable $operator $action -}}
{{- end -}}
{{- define "sharedlabels" -}}
app: {{ template "appname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ template "appname" . }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{ toYaml $.Values.extraLabels }}
{{- end }}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "Yacy.fullname" . }}-config
name: {{ template "fullname" . }}-config
labels:
{{- include "Yacy.labels" . | nindent 4 }}
data:
......@@ -11,4 +11,4 @@ data:
{{ .name }}={{ .value }}
{{- end }}
{{- end }}
port = {{ .Values.yacy.port }}
\ No newline at end of file
port = {{ .Values.yacy.port }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "Yacy.fullname" . }}-admin-credentials
name: {{ template "fullname" . }}-admin-credentials
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook-delete-policy": "before-hook-creation"
......@@ -10,4 +10,4 @@ metadata:
data:
ADMIN_USER: {{ default "admin" .Values.yacy.admin.username | b64enc | quote }}
ADMIN_REALM: {{ default "Yacy Admin UI" .Values.yacy.admin.realm | b64enc | quote }}
ADMIN_PASSWORD: {{ default (randAlphaNum 10) .Values.yacy.admin.password | b64enc | quote }}
\ No newline at end of file
ADMIN_PASSWORD: {{ default (randAlphaNum 10) .Values.yacy.admin.password | b64enc | quote }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "Yacy.name" . }}
name: {{ template "fullname" . }}
labels:
{{- include "Yacy.labels" . | nindent 4 }}
spec:
......
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "Yacy.name" . }}
name: {{ template "trackableappname" . }}
labels:
appname: yacy
{{- include "Yacy.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "Yacy.name" . }}
serviceName: {{ template "fullname" . }}
selector:
matchLabels:
{{- include "Yacy.selectorLabels" . | nindent 6 }}
......@@ -34,7 +34,7 @@ spec:
claimName: yacy-data
- name: yacy-config
configMap:
name: {{ include "Yacy.fullname" . }}-config
name: {{ template "fullname" . }}-config
items:
- key: "yacy.init"
path: "yacy.init"
......@@ -69,7 +69,7 @@ spec:
value: {{ .Values.yacy.namePrefix }}
envFrom:
- secretRef:
name: {{ include "Yacy.fullname" . }}-admin-credentials
name: {{ template "fullname" . }}-admin-credentials
ports:
- name: http
containerPort: {{ .Values.yacy.port }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment