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: spec:
attachRequired: false attachRequired: false
podInfoOnMount: true podInfoOnMount: true
{{- if semverCompare ">=1.16" .Capabilities.KubeVersion.Version }}
volumeLifecycleModes: volumeLifecycleModes:
- Persistent - Persistent
{{- end }}

View File

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

View File

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

View File

@ -1,22 +1,20 @@
kind: DaemonSet
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet
metadata: metadata:
name: csi-rawfile-node name: {{ include "rawfile-csi.fullname" . }}-node
spec: spec:
updateStrategy: updateStrategy:
rollingUpdate: rollingUpdate:
maxUnavailable: "100%" maxUnavailable: "100%"
selector: selector:
matchLabels: matchLabels: &selectorLabels
app: csi-rawfile-node {{- include "rawfile-csi.selectorLabels" . | nindent 6 }}
component: node
template: template:
metadata: metadata:
labels: labels: *selectorLabels
app: csi-rawfile-node
spec: spec:
serviceAccount: csi-rawfile-driver serviceAccount: {{ include "rawfile-csi.fullname" . }}-driver
hostNetwork: true
hostIPC: true
priorityClassName: system-node-critical priorityClassName: system-node-critical
tolerations: tolerations:
- operator: "Exists" - operator: "Exists"
@ -39,8 +37,10 @@ spec:
type: DirectoryOrCreate type: DirectoryOrCreate
containers: containers:
- name: csi-driver - name: csi-driver
image: registry.hamdocker.ir/hamravesh/rawfile-csi:master image: "{{ .Values.node.image.repository }}:{{ .Values.node.image.tag }}"
imagePullPolicy: Always imagePullPolicy: {{ .Values.node.image.pullPolicy }}
securityContext:
privileged: true
env: env:
- name: CSI_ENDPOINT - name: CSI_ENDPOINT
value: unix:///csi/csi.sock value: unix:///csi/csi.sock
@ -49,8 +49,6 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: spec.nodeName fieldPath: spec.nodeName
securityContext:
privileged: true
volumeMounts: volumeMounts:
- name: socket-dir - name: socket-dir
mountPath: /csi mountPath: /csi
@ -59,6 +57,8 @@ spec:
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
- name: data-dir - name: data-dir
mountPath: /data mountPath: /data
resources:
{{- toYaml .Values.node.resources | nindent 12 }}
- name: node-driver-registrar - name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0 image: quay.io/k8scsi/csi-node-driver-registrar:v1.2.0
imagePullPolicy: IfNotPresent 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} name: {name}
namespace: {namespace} namespace: {namespace}
spec: spec:
# FIXME: hardcoded
serviceAccount: rawfile-csi-controller
restartPolicy: Never restartPolicy: Never
terminationGracePeriodSeconds: 0 terminationGracePeriodSeconds: 0
tolerations: tolerations:
@ -27,9 +25,11 @@ spec:
mountPath: /data mountPath: /data
resources: resources:
requests: &rsc requests: &rsc
cpu: 10m
memory: 100Mi
limit:
cpu: 100m cpu: 100m
memory: 100Mi memory: 100Mi
limit: *rsc
command: command:
- /bin/sh - /bin/sh
- -c - -c