Skip to content

Commit

Permalink
example helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gardner committed Jan 22, 2019
1 parent 1ec7dca commit 380c257
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 0 deletions.
22 changes: 22 additions & 0 deletions helm/draino/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
4 changes: 4 additions & 0 deletions helm/draino/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: draino chart
name: draino
version: 0.1.0
32 changes: 32 additions & 0 deletions helm/draino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "draino.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 "draino.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 "draino.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
31 changes: 31 additions & 0 deletions helm/draino/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ include "draino.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "draino.name" . }}
helm.sh/chart: {{ include "draino.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
rules:
- apiGroups: ['']
resources: [events]
verbs: [create, patch, update]
- apiGroups: ['']
resources: [nodes]
verbs: [get, watch, list, update]
- apiGroups: ['']
resources: [nodes/status]
verbs: [patch]
- apiGroups: ['']
resources: [pods]
verbs: [get, watch, list]
- apiGroups: ['']
resources: [pods/eviction]
verbs: [create]
- apiGroups: [extensions]
resources: [daemonsets]
verbs: [get, watch, list]

{{- end -}}
19 changes: 19 additions & 0 deletions helm/draino/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ include "draino.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "draino.name" . }}
helm.sh/chart: {{ include "draino.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "draino.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "draino.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
56 changes: 56 additions & 0 deletions helm/draino/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "draino.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "draino.name" . }}
helm.sh/chart: {{ include "draino.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "draino.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "draino.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /draino
{{- if .Values.dryRun }}
- --dry-run
{{ end }}
{{- range $key, $value := .Values.extraArgs }}
- --{{ $key }}{{ if $value }}={{ $value }}{{ end }}
{{- end }}
{{- range .Values.conditions }}
- {{ . }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 10002
initialDelaySeconds: 30
resources:
{{- toYaml .Values.resources | nindent 12 }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "draino.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
11 changes: 11 additions & 0 deletions helm/draino/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.rbac.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "draino.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "draino.name" . }}
helm.sh/chart: {{ include "draino.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
30 changes: 30 additions & 0 deletions helm/draino/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dryRun: false

extraArgs: {}

conditions: {}

replicaCount: 1

image:
repository: planetlabs/draino
tag: 5e07e93
pullPolicy: IfNotPresent

resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi

rbac:
create: true
serviceAccountName:

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit 380c257

Please sign in to comment.