Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 52c4e7c

Browse files
committed
Added helm chart
closes: #20
1 parent ddbd6fd commit 52c4e7c

11 files changed

+604
-0
lines changed

deploy/helm/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

deploy/helm/Chart.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v2
2+
name: csi-s3
3+
description: A Container Storage Interface for S3
4+
type: application
5+
version: 0.1.0
6+
appVersion: "1.1.1"
7+
keywords:
8+
- s3
9+
- csi
10+
home: https://github.com/ctrox/csi-s3
11+
sources:
12+
- https://github.com/ctrox/csi-s3/deploy/helm

deploy/helm/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Helm chart for csi-s3
2+
3+
This chart adds S3 volume support to your cluster.
4+
5+
## Install chart
6+
7+
```shell
8+
helm install --namespace kube-system csi-s3 .
9+
```
10+
11+
After installation succeeds, you can get a status of Chart: `helm status csi-s3`.
12+
13+
## Delete Chart
14+
15+
```shell
16+
helm uninstall csi-s3 --namespace kube-system`
17+
```
18+
19+
## Configuration
20+
21+
By default, this chart creates a secret and a storage class.
22+
23+
The following table lists all configuration parameters and their default values.
24+
25+
| Parameter | Description | Default |
26+
| ---------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------ |
27+
| `storageClass.create` | Specifies whether the storage class should be created | true |
28+
| `storageClass.name` | Storage class name | csi-s3 |
29+
| `storageClass.bucket` | Existing bucket name to use, or leave blank to create | |
30+
| `storageClass.usePrefix` | Enable the prefix feature to avoid the removal of the prefix or bucket | false |
31+
| `storageClass.prefix` | can be empty (mounts bucket root), an existing prefix or a new one. | |
32+
| `storageClass.reclaimPolicy` | Volume reclaim policy | Delete |
33+
| `storageClass.annotations` | Annotations for the storage class | |
34+
| `secret.create` | Specifies whether the secret should be created | true |
35+
| `secret.name` | Name of the secret | csi-s3-secret |
36+
| `secret.accessKey` | S3 Access Key | |
37+
| `secret.secretKey` | S3 Secret Key | |
38+
| `secret.endpoint` | Endpoint | https://storage.yandexcloud.net |

deploy/helm/templates/NOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The csi-s3 driver has been successfully installed.

deploy/helm/templates/_helpers.tpl

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "csi-s3.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "csi-s3.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "csi-s3.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "csi-s3.labels" -}}
37+
helm.sh/chart: {{ include "csi-s3.chart" . }}
38+
{{ include "csi-s3.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "csi-s3.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "csi-s3.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}

deploy/helm/templates/attacher.yaml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: csi-attacher-sa
5+
labels:
6+
{{- include "csi-s3.labels" . | nindent 4 }}
7+
{{- with .Values.serviceAccount.annotations }}
8+
annotations:
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
---
12+
kind: ClusterRole
13+
apiVersion: rbac.authorization.k8s.io/v1
14+
metadata:
15+
name: external-attacher-runner
16+
labels:
17+
{{- include "csi-s3.labels" . | nindent 4 }}
18+
rules:
19+
- apiGroups: [""]
20+
resources: ["secrets"]
21+
verbs: ["get", "list"]
22+
- apiGroups: [""]
23+
resources: ["events"]
24+
verbs: ["get", "list", "watch", "update"]
25+
- apiGroups: [""]
26+
resources: ["persistentvolumes"]
27+
verbs: ["get", "list", "watch", "update"]
28+
- apiGroups: [""]
29+
resources: ["nodes"]
30+
verbs: ["get", "list", "watch"]
31+
- apiGroups: ["storage.k8s.io"]
32+
resources: ["volumeattachments"]
33+
verbs: ["get", "list", "watch", "update", "patch"]
34+
---
35+
kind: ClusterRoleBinding
36+
apiVersion: rbac.authorization.k8s.io/v1
37+
metadata:
38+
name: csi-attacher-role
39+
labels:
40+
{{- include "csi-s3.labels" . | nindent 4 }}
41+
subjects:
42+
- kind: ServiceAccount
43+
name: csi-attacher-sa
44+
namespace: "{{ .Release.Namespace }}"
45+
roleRef:
46+
kind: ClusterRole
47+
name: external-attacher-runner
48+
apiGroup: rbac.authorization.k8s.io
49+
---
50+
# needed for StatefulSet
51+
apiVersion: v1
52+
kind: Service
53+
metadata:
54+
name: csi-attacher-s3
55+
labels:
56+
{{- include "csi-s3.labels" . | nindent 4 }}
57+
app: csi-attacher-s3
58+
spec:
59+
selector:
60+
{{- include "csi-s3.selectorLabels" . | nindent 4 }}
61+
app: csi-attacher-s3
62+
ports:
63+
- name: csi-s3-dummy
64+
port: 65535
65+
---
66+
kind: StatefulSet
67+
apiVersion: apps/v1
68+
metadata:
69+
name: csi-attacher-s3
70+
labels:
71+
{{- include "csi-s3.labels" . | nindent 4 }}
72+
spec:
73+
serviceName: csi-attacher-s3
74+
replicas: 1
75+
selector:
76+
matchLabels:
77+
{{- include "csi-s3.selectorLabels" . | nindent 6 }}
78+
app: csi-attacher-s3
79+
template:
80+
metadata:
81+
labels:
82+
{{- include "csi-s3.selectorLabels" . | nindent 8 }}
83+
app: csi-attacher-s3
84+
spec:
85+
serviceAccountName: csi-attacher-sa
86+
containers:
87+
- name: csi-attacher
88+
image: "{{ .Values.attacher.image.repository }}:{{ .Values.attacher.image.tag | default .Chart.AppVersion }}"
89+
imagePullPolicy: "{{ .Values.attacher.image.pullPolicy }}"
90+
args:
91+
- "--v=4"
92+
- "--csi-address=$(ADDRESS)"
93+
env:
94+
- name: ADDRESS
95+
value: /var/lib/kubelet/plugins/ch.ctrox.csi.s3-driver/csi.sock
96+
volumeMounts:
97+
- name: socket-dir
98+
mountPath: /var/lib/kubelet/plugins/ch.ctrox.csi.s3-driver
99+
volumes:
100+
- name: socket-dir
101+
hostPath:
102+
path: /var/lib/kubelet/plugins/ch.ctrox.csi.s3-driver
103+
type: DirectoryOrCreate
104+
tolerations:
105+
- key: node-role.kubernetes.io/master
106+
operator: "Exists"

deploy/helm/templates/csi-s3.yaml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: csi-s3
5+
labels:
6+
{{- include "csi-s3.labels" . | nindent 4 }}
7+
{{- with .Values.serviceAccount.annotations }}
8+
annotations:
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
---
12+
kind: ClusterRole
13+
apiVersion: rbac.authorization.k8s.io/v1
14+
metadata:
15+
name: csi-s3
16+
labels:
17+
{{- include "csi-s3.labels" . | nindent 4 }}
18+
rules:
19+
- apiGroups: [""]
20+
resources: ["secrets"]
21+
verbs: ["get", "list"]
22+
- apiGroups: [""]
23+
resources: ["nodes"]
24+
verbs: ["get", "list", "update"]
25+
- apiGroups: [""]
26+
resources: ["namespaces"]
27+
verbs: ["get", "list"]
28+
- apiGroups: [""]
29+
resources: ["persistentvolumes"]
30+
verbs: ["get", "list", "watch", "update"]
31+
- apiGroups: ["storage.k8s.io"]
32+
resources: ["volumeattachments"]
33+
verbs: ["get", "list", "watch", "update"]
34+
---
35+
kind: ClusterRoleBinding
36+
apiVersion: rbac.authorization.k8s.io/v1
37+
metadata:
38+
name: csi-s3
39+
labels:
40+
{{- include "csi-s3.labels" . | nindent 4 }}
41+
subjects:
42+
- kind: ServiceAccount
43+
name: csi-s3
44+
namespace: "{{ .Release.Namespace }}"
45+
roleRef:
46+
kind: ClusterRole
47+
name: csi-s3
48+
apiGroup: rbac.authorization.k8s.io
49+
---
50+
kind: DaemonSet
51+
apiVersion: apps/v1
52+
metadata:
53+
name: csi-s3
54+
labels:
55+
{{- include "csi-s3.labels" . | nindent 4 }}
56+
spec:
57+
selector:
58+
matchLabels:
59+
{{- include "csi-s3.selectorLabels" . | nindent 6 }}
60+
app: csi-s3
61+
template:
62+
metadata:
63+
labels:
64+
{{- include "csi-s3.selectorLabels" . | nindent 8 }}
65+
app: csi-s3
66+
spec:
67+
serviceAccountName: csi-s3
68+
hostNetwork: true
69+
containers:
70+
- name: driver-registrar
71+
image: "{{ .Values.registrar.image.repository }}:{{ .Values.registrar.image.tag | default .Chart.AppVersion }}"
72+
imagePullPolicy: "{{ .Values.registrar.image.pullPolicy }}"
73+
args:
74+
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
75+
- "--v=4"
76+
- "--csi-address=$(ADDRESS)"
77+
env:
78+
- name: ADDRESS
79+
value: /csi/csi.sock
80+
- name: DRIVER_REG_SOCK_PATH
81+
value: /var/lib/kubelet/plugins/ch.ctrox.csi.s3-driver/csi.sock
82+
- name: KUBE_NODE_NAME
83+
valueFrom:
84+
fieldRef:
85+
fieldPath: spec.nodeName
86+
volumeMounts:
87+
- name: plugin-dir
88+
mountPath: /csi
89+
- name: registration-dir
90+
mountPath: /registration/
91+
- name: csi-s3
92+
image: "{{ .Values.csi.image.repository }}:{{ .Values.csi.image.tag | default .Chart.AppVersion }}"
93+
imagePullPolicy: "{{ .Values.csi.image.pullPolicy }}"
94+
securityContext:
95+
privileged: true
96+
capabilities:
97+
add: ["SYS_ADMIN"]
98+
allowPrivilegeEscalation: true
99+
args:
100+
- "--endpoint=$(CSI_ENDPOINT)"
101+
- "--nodeid=$(NODE_ID)"
102+
- "--v=4"
103+
env:
104+
- name: CSI_ENDPOINT
105+
value: unix:///csi/csi.sock
106+
- name: NODE_ID
107+
valueFrom:
108+
fieldRef:
109+
fieldPath: spec.nodeName
110+
volumeMounts:
111+
- name: plugin-dir
112+
mountPath: /csi
113+
- name: pods-mount-dir
114+
mountPath: /var/lib/kubelet/pods
115+
mountPropagation: "Bidirectional"
116+
- name: fuse-device
117+
mountPath: /dev/fuse
118+
volumes:
119+
- name: registration-dir
120+
hostPath:
121+
path: /var/lib/kubelet/plugins_registry/
122+
type: DirectoryOrCreate
123+
- name: plugin-dir
124+
hostPath:
125+
path: /var/lib/kubelet/plugins/ch.ctrox.csi.s3-driver
126+
type: DirectoryOrCreate
127+
- name: pods-mount-dir
128+
hostPath:
129+
path: /var/lib/kubelet/pods
130+
type: Directory
131+
- name: fuse-device
132+
hostPath:
133+
path: /dev/fuse

0 commit comments

Comments
 (0)