diff --git a/deployments/without-creds/sysctl/.helmignore b/deployments/without-creds/sysctl/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/deployments/without-creds/sysctl/.helmignore @@ -0,0 +1,22 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployments/without-creds/sysctl/Chart.yaml b/deployments/without-creds/sysctl/Chart.yaml new file mode 100644 index 0000000..ad5f1c7 --- /dev/null +++ b/deployments/without-creds/sysctl/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm Chart for configuring kernel parameters +name: sysctl +version: 0.1.0 diff --git a/deployments/without-creds/sysctl/templates/NOTES.txt b/deployments/without-creds/sysctl/templates/NOTES.txt new file mode 100644 index 0000000..e69de29 diff --git a/deployments/without-creds/sysctl/templates/_helpers.tpl b/deployments/without-creds/sysctl/templates/_helpers.tpl new file mode 100644 index 0000000..6d38ed5 --- /dev/null +++ b/deployments/without-creds/sysctl/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "sysctl.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 "sysctl.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 "sysctl.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deployments/without-creds/sysctl/templates/daemonset.yaml b/deployments/without-creds/sysctl/templates/daemonset.yaml new file mode 100644 index 0000000..029c16d --- /dev/null +++ b/deployments/without-creds/sysctl/templates/daemonset.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "sysctl.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "sysctl.name" . }} + helm.sh/chart: {{ include "sysctl.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ include "sysctl.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "sysctl.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + privileged: true + terminationGracePeriodSeconds: '5' + command: + - /bin/sh + - -c + - | + set -o errexit + set -o xtrace + + {{- if empty .Values.sysctl }} + {{ fail "at least one sysctl option must be set." }} + {{- end }} + + while sysctl -w {{ range .Values.sysctl }}{{ . }}{{- end }} + do + sleep 120s + done + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/deployments/without-creds/sysctl/values.yaml b/deployments/without-creds/sysctl/values.yaml new file mode 100644 index 0000000..9ab93ad --- /dev/null +++ b/deployments/without-creds/sysctl/values.yaml @@ -0,0 +1,30 @@ +image: + repository: busybox + tag: latest + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "" + +resources: + limits: + cpu: 50m + memory: 20Mi + requests: + cpu: 50m + memory: 20Mi + +nodeSelector: + cloud.google.com/gke-nodepool: workers-1 + +affinity: {} + +# A list of `sysctl` values to configure. +# For instance: +# +# sysctl: [ "vm.min_free_kbytes=7852" ] +# +# Note: at least one value must be configured. +# +sysctl: + - vm.min_free_kbytes=1000000