Create helm chart

This commit is contained in:
Mehran Kholdi 2020-04-28 17:52:20 +04:30
parent 336f72a3c9
commit 420b0f4ff7
9 changed files with 156 additions and 37 deletions

View File

@ -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/

View File

@ -0,0 +1,6 @@
apiVersion: v2
name: rawfile-csi
description: RawFile Driver Container Storage Interface
type: application
version: 0.1.0
appVersion: 0.0.1

View File

@ -5,5 +5,7 @@ metadata:
spec:
attachRequired: false
podInfoOnMount: true
{{- if semverCompare ">=1.16" .Capabilities.KubeVersion.Version }}
volumeLifecycleModes:
- Persistent
{{- end }}

View File

@ -1,13 +1,14 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-rawfile-driver
namespace: kube-system
name: {{ include "rawfile-csi.fullname" . }}-driver
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 2 }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-rawfile-provisioner
name: {{ include "rawfile-csi.fullname" . }}-provisioner
rules:
- apiGroups: [""]
resources: ["secrets"]
@ -40,20 +41,20 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-rawfile-provisioner
name: {{ include "rawfile-csi.fullname" . }}-provisioner
subjects:
- kind: ServiceAccount
name: csi-rawfile-driver
namespace: kube-system
name: {{ include "rawfile-csi.fullname" . }}-driver
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: csi-rawfile-provisioner
name: {{ include "rawfile-csi.fullname" . }}-provisioner
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-rawfile-broker
name: {{ include "rawfile-csi.fullname" . }}-broker
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
@ -65,12 +66,12 @@ rules:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-rawfile-broker
name: {{ include "rawfile-csi.fullname" . }}-broker
subjects:
- kind: ServiceAccount
name: csi-rawfile-driver
namespace: kube-system
name: {{ include "rawfile-csi.fullname" . }}-driver
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: csi-rawfile-broker
name: {{ include "rawfile-csi.fullname" . }}-broker
apiGroup: rbac.authorization.k8s.io

View File

@ -1,20 +1,20 @@
kind: Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: csi-rawfile-controller
name: {{ include "rawfile-csi.fullname" . }}-controller
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: csi-rawfile-controller
matchLabels: &selectorLabels
{{- include "rawfile-csi.selectorLabels" . | nindent 6 }}
component: controller
template:
metadata:
labels:
app: csi-rawfile-controller
labels: *selectorLabels
spec:
serviceAccount: csi-rawfile-driver
serviceAccount: {{ include "rawfile-csi.fullname" . }}-driver
priorityClassName: system-cluster-critical
tolerations:
- key: "node-role.kubernetes.io/master"
@ -26,14 +26,16 @@ spec:
emptyDir: {}
containers:
- name: csi-driver
image: registry.hamdocker.ir/hamravesh/rawfile-csi:master
imagePullPolicy: Always
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
resources:
{{- toYaml .Values.controller.resources | nindent 12 }}
- name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.6.0
imagePullPolicy: IfNotPresent

View File

@ -1,22 +1,20 @@
kind: DaemonSet
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: csi-rawfile-node
name: {{ include "rawfile-csi.fullname" . }}-node
spec:
updateStrategy:
rollingUpdate:
maxUnavailable: "100%"
selector:
matchLabels:
app: csi-rawfile-node
matchLabels: &selectorLabels
{{- include "rawfile-csi.selectorLabels" . | nindent 6 }}
component: node
template:
metadata:
labels:
app: csi-rawfile-node
labels: *selectorLabels
spec:
serviceAccount: csi-rawfile-driver
hostNetwork: true
hostIPC: true
serviceAccount: {{ include "rawfile-csi.fullname" . }}-driver
priorityClassName: system-node-critical
tolerations:
- operator: "Exists"
@ -39,8 +37,10 @@ spec:
type: DirectoryOrCreate
containers:
- name: csi-driver
image: registry.hamdocker.ir/hamravesh/rawfile-csi:master
imagePullPolicy: Always
image: "{{ .Values.node.image.repository }}:{{ .Values.node.image.tag }}"
imagePullPolicy: {{ .Values.node.image.pullPolicy }}
securityContext:
privileged: true
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
@ -49,8 +49,6 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
securityContext:
privileged: true
volumeMounts:
- name: socket-dir
mountPath: /csi
@ -59,6 +57,8 @@ spec:
mountPropagation: "Bidirectional"
- name: data-dir
mountPath: /data
resources:
{{- toYaml .Values.node.resources | nindent 12 }}
- name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
imagePullPolicy: IfNotPresent

View File

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "rawfile-csi.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 "rawfile-csi.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 "rawfile-csi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "rawfile-csi.labels" -}}
helm.sh/chart: {{ include "rawfile-csi.chart" . }}
{{ include "rawfile-csi.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "rawfile-csi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "rawfile-csi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "rawfile-csi.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "rawfile-csi.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,22 @@
defaults: &defaults
image:
repository: registry.hamdocker.ir/hamravesh/rawfile-csi
tag: master
pullPolicy: Always
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 10m
memory: 100Mi
controller:
<< : *defaults
node:
<< : *defaults
metrics:
enabled: false
imagePullSecrets: []

View File

@ -4,8 +4,6 @@ metadata:
name: {name}
namespace: {namespace}
spec:
# FIXME: hardcoded
serviceAccount: rawfile-csi-controller
restartPolicy: Never
terminationGracePeriodSeconds: 0
tolerations:
@ -27,9 +25,11 @@ spec:
mountPath: /data
resources:
requests: &rsc
cpu: 10m
memory: 100Mi
limit:
cpu: 100m
memory: 100Mi
limit: *rsc
command:
- /bin/sh
- -c