Commit ab8296c8 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files
parents c71c4003 889c47a8
......@@ -12,4 +12,4 @@ data:
{{ .name }}={{ .value }}
{{- end }}
{{- end }}
port = {{ .Values.yacy.port }}
\ No newline at end of file
port = {{ .Values.yacy.port }}
......@@ -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 }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- 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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trimSuffix "-app" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "appname" -}}
{{- $releaseName := default .Release.Name .Values.releaseOverride -}}
{{- printf "%s" $releaseName | trunc 63 | trimSuffix "-" -}}
{{- 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 -}}
{{/*
Get a hostname from URL
*/}}
{{- define "hostname" -}}
{{- . | trimPrefix "http://" | trimPrefix "https://" | trimSuffix "/" | trim | quote -}}
{{- end -}}
{{/*
Get SecRule's arguments with unescaped single&double quotes
*/}}
{{- 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 -}}
......@@ -3,7 +3,7 @@ kind: Service
metadata:
name: {{ include "Yacy.name" . }}
labels:
{{- include "Yacy.labels" . | nindent 4 }}
{{ include "sharedlabels" . | indent 4 }}
spec:
type: NodePort
externalTrafficPolicy: Local
......@@ -14,4 +14,7 @@ spec:
protocol: TCP
name: http
selector:
{{- include "Yacy.selectorLabels" . | nindent 4 }}
app: {{ template "appname" . }}
tier: "{{ .Values.application.tier }}"
track: "{{ .Values.application.track }}"
{{- with .Values.serviceAccount -}}
{{- if .createNew }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .name | quote }}
{{- if .annotations }}
annotations:
{{ toYaml .annotations | indent 4 }}
{{- end }}
{{- end }}
{{- end -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "trackableappname" . }}
labels:
appname: yacy
track: "{{ .Values.application.track }}"
tier: "{{ .Values.application.tier }}"
{{ include "sharedlabels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ template "fullname" . }}
selector:
matchLabels:
matchLabels:
app: {{ template "appname" . }}
track: "{{ .Values.application.track }}"
tier: "{{ .Values.application.tier }}"
release: {{ .Release.Name }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
appname: yacy
track: "{{ .Values.application.track }}"
tier: "{{ .Values.application.tier }}"
{{ include "sharedlabels" . | indent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (.Values.serviceAccount.name) (.Values.serviceAccountName) }}
serviceAccountName: {{ .Values.serviceAccount.name | default .Values.serviceAccountName | quote }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: yacy-data
persistentVolumeClaim:
claimName: yacy-data
- name: yacy-config
configMap:
name: {{ template "fullname" . }}-config
items:
- key: "yacy.init"
path: "yacy.init"
initContainers:
- name: clear-config
image: busybox:1.28
command: ['sh', '-c', "rm -f /data/yacy_search_server/DATA/SETTINGS/yacy.conf"]
volumeMounts:
- name: yacy-data
mountPath: /data
containers:
- name: {{ .Chart.Name }}-search-server
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "yacy/yacy_search_server:latest"
imagePullPolicy: "IfNotPresent"
command: ['bash']
args:
- -c
- >-
cat /config/yacy.init >> /opt/yacy_search_server/defaults/yacy.init &&
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1 &&
ordinal=${BASH_REMATCH[1]} &&
if [ ! -z $NETWORK_UNIT_AGENT ]; then echo "network.unit.agent = $NETWORK_UNIT_AGENT-$ordinal" >> /opt/yacy_search_server/defaults/yacy.init; fi &&
export ADMIN_PASSWORD=$(echo -n "${ADMIN_USER}:${ADMIN_REALM}:${ADMIN_PASSWORD}" | md5sum | awk '{print $1}') &&
echo "adminAccountUserName = ${ADMIN_USER}" >> /opt/yacy_search_server/defaults/yacy.init &&
echo "adminRealm = ${ADMIN_REALM}" >> /opt/yacy_search_server/defaults/yacy.init &&
echo "adminAccountBase64MD5 = MD5:${ADMIN_PASSWORD}" >> /opt/yacy_search_server/defaults/yacy.init &&
/opt/yacy_search_server/startYACY.sh -f
env:
- name: NETWORK_UNIT_AGENT
value: {{ .Values.yacy.namePrefix }}
envFrom:
- secretRef:
name: {{ template "fullname" . }}-admin-credentials
ports:
- name: http
containerPort: {{ .Values.yacy.port }}
hostPort: {{ .Values.yacy.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
volumeMounts:
# - name: yacy-data
# mountPath: /opt/yacy_search_server/DATA
- name: yacy-config
mountPath: "/config"
readOnly: false
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 }}
volumeClaimTemplates:
- metadata:
name: yacy-data
labels:
{{ include "sharedlabels" . | indent 10 }}
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.yacy.volume.class }}
resources:
requests:
storage: {{ .Values.yacy.volume.size }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ template "trackableappname" . }}-test-connection"
labels:
{{ include "sharedlabels" . | indent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ template "trackableappname" . }}:{{ .Values.yacy.port }}']
restartPolicy: Never
# Default values for Yacy.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
yacy:
# A name Prefix for your yacy instances (corresponds to yacy option network.unit.agent)
# A ordinal number corresponding to the replica will get added to it.
namePrefix: sumaev
ports: 31234
admin:
username:
realm: Yacy Admin UI
password:
volume:
class: rook-ceph-block
size: 100Gi
# Here you can define additional config parameters for your yacy deployment.
# You can set any valid yacy config
# i.e.
# - name: network.unit.domain.nocheck
# value: true
# The following configs are already set by above values and shouldn't be set again:
# - port
# - network.unit.agent
# - adminRealm, adminAccountUserName, adminAccountBase64MD5
additionalConfig:
- name: autocrawl
value: false
- name: crawlResponse
value: false
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
name:
annotations: {}
createNew: false
podAnnotations: {}
podSecurityContext:
runAsUser: 102
runAsGroup: 103
fsGroup: 103
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity:
# This is an anti affinity that prevents multiple yacy pods
# from spawning on the same node as that is currently not possible due to
# external reachability issues
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "appname"
operator: In
values:
- yacy
topologyKey: "kubernetes.io/hostname"
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