From f1910bbb29b3c501f9e7ec24c3a959449e925cd9 Mon Sep 17 00:00:00 2001 From: Linuro Date: Tue, 29 Dec 2020 18:59:42 +0000 Subject: [PATCH] add fishnet --- zombi/fishnet/.helmignore | 23 +++++++++ zombi/fishnet/Chart.yaml | 4 ++ zombi/fishnet/templates/_helpers.tpl | 62 +++++++++++++++++++++++ zombi/fishnet/templates/deployment.yaml | 66 +++++++++++++++++++++++++ zombi/fishnet/values.yaml | 46 +++++++++++++++++ 5 files changed, 201 insertions(+) create mode 100644 zombi/fishnet/.helmignore create mode 100644 zombi/fishnet/Chart.yaml create mode 100644 zombi/fishnet/templates/_helpers.tpl create mode 100644 zombi/fishnet/templates/deployment.yaml create mode 100644 zombi/fishnet/values.yaml diff --git a/zombi/fishnet/.helmignore b/zombi/fishnet/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/zombi/fishnet/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/zombi/fishnet/Chart.yaml b/zombi/fishnet/Chart.yaml new file mode 100644 index 0000000..fe70878 --- /dev/null +++ b/zombi/fishnet/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +name: fishnet +description: distributed stockfish analysis for lichess +version: 0.1.0 diff --git a/zombi/fishnet/templates/_helpers.tpl b/zombi/fishnet/templates/_helpers.tpl new file mode 100644 index 0000000..5d82c15 --- /dev/null +++ b/zombi/fishnet/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "fishnet.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 "fishnet.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 "fishnet.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "fishnet.labels" -}} +helm.sh/chart: {{ include "fishnet.chart" . }} +{{ include "fishnet.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "fishnet.selectorLabels" -}} +app.kubernetes.io/name: {{ include "fishnet.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "fishnet.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "fishnet.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/zombi/fishnet/templates/deployment.yaml b/zombi/fishnet/templates/deployment.yaml new file mode 100644 index 0000000..189b573 --- /dev/null +++ b/zombi/fishnet/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "fishnet.fullname" . }} + labels: + {{- include "fishnet.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "fishnet.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "fishnet.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + 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 }} + volumeMounts: + - mountPath: /tmp + name: tmp + env: + - name: KEY + {{- if .Values.fishnetKey }} + value: {{ .Values.cookieSecret.key }} + {{- else }} + valueFrom: + secretKeyRef: + name: fishnet + key: key + {{- end }} + - name: USER_BACKLOG + value: {{ .Values.userBacklog }} + - name: SYSTEM_BACKLOG + value: {{ .Values.systemBacklog }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: tmp + emptyDir: {} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/zombi/fishnet/values.yaml b/zombi/fishnet/values.yaml new file mode 100644 index 0000000..d5a9973 --- /dev/null +++ b/zombi/fishnet/values.yaml @@ -0,0 +1,46 @@ +# Default values for fishnet. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: niklasf/fishnet + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + +# fishnetKey: h5cj6d +userBacklog: "0s" +systemBacklog: "0s" +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: 3 + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {}