-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add hostpath storageclass and csi drivers
Signed-off-by: Huamin Chen <[email protected]>
- Loading branch information
Showing
16 changed files
with
704 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
charts/internal/seed-controlplane/charts/csi-hostpath/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
description: Helm chart for kubernetes CSI components including external-attacher, external-provisioner, external-resizer | ||
name: csi-hostpath | ||
version: 1.0.0 |
60 changes: 60 additions & 0 deletions
60
charts/internal/seed-controlplane/charts/csi-hostpath/templates/csi-attacher.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: csi-attacher | ||
labels: | ||
app: csi-attacher | ||
spec: | ||
selector: | ||
app: csi-attacher | ||
ports: | ||
- name: dummy | ||
port: 12345 | ||
|
||
--- | ||
kind: StatefulSet | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: csi-attacher | ||
spec: | ||
serviceName: "csi-attacher" | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: csi-attacher | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-attacher | ||
spec: | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- csi-hostpathplugin | ||
topologyKey: kubernetes.io/hostname | ||
serviceAccountName: csi-attacher | ||
containers: | ||
- name: csi-attacher | ||
image: {{ index .Values.images "csi-attacher" }} | ||
args: | ||
- --v=5 | ||
- --csi-address=/csi/csi.sock | ||
securityContext: | ||
# This is necessary only for systems with SELinux, where | ||
# non-privileged sidecar containers cannot access unix domain socket | ||
# created by privileged CSI driver container. | ||
privileged: true | ||
volumeMounts: | ||
- mountPath: /csi | ||
name: socket-dir | ||
|
||
volumes: | ||
- hostPath: | ||
path: /var/lib/kubelet/plugins/csi-hostpath | ||
type: DirectoryOrCreate | ||
name: socket-dir |
62 changes: 62 additions & 0 deletions
62
charts/internal/seed-controlplane/charts/csi-hostpath/templates/csi-provisioner.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: csi-provisioner | ||
namespace: kube-system | ||
labels: | ||
app: csi-provisioner | ||
spec: | ||
selector: | ||
app: csi-provisioner | ||
ports: | ||
- name: dummy | ||
port: 12345 | ||
|
||
--- | ||
kind: StatefulSet | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: csi-provisioner | ||
namespace: kube-system | ||
spec: | ||
serviceName: "csi-provisioner" | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: csi-provisioner | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-provisioner | ||
spec: | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- csi-hostpathplugin | ||
topologyKey: kubernetes.io/hostname | ||
serviceAccountName: csi-provisioner | ||
containers: | ||
- name: csi-provisioner | ||
image: {{ index .Values.images "csi-provisioner" }} | ||
args: | ||
- -v=5 | ||
- --csi-address=/csi/csi.sock | ||
- --feature-gates=Topology=true | ||
securityContext: | ||
# This is necessary only for systems with SELinux, where | ||
# non-privileged sidecar containers cannot access unix domain socket | ||
# created by privileged CSI driver container. | ||
privileged: true | ||
volumeMounts: | ||
- mountPath: /csi | ||
name: socket-dir | ||
volumes: | ||
- hostPath: | ||
path: /var/lib/kubelet/plugins/csi-hostpath | ||
type: DirectoryOrCreate | ||
name: socket-dir |
61 changes: 61 additions & 0 deletions
61
charts/internal/seed-controlplane/charts/csi-hostpath/templates/csi-resizer.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: csi-resizer | ||
namespace: kube-system | ||
labels: | ||
app: csi-resizer | ||
spec: | ||
selector: | ||
app: csi-resizer | ||
ports: | ||
- name: dummy | ||
port: 12345 | ||
|
||
--- | ||
kind: StatefulSet | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: csi-resizer | ||
namespace: kube-system | ||
spec: | ||
serviceName: "csi-resizer" | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: csi-resizer | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-resizer | ||
spec: | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- csi-hostpathplugin | ||
topologyKey: kubernetes.io/hostname | ||
serviceAccountName: csi-resizer | ||
containers: | ||
- name: csi-resizer | ||
image: {{ index .Values.images "csi-resizer" }} | ||
args: | ||
- -v=5 | ||
- -csi-address=/csi/csi.sock | ||
securityContext: | ||
# This is necessary only for systems with SELinux, where | ||
# non-privileged sidecar containers cannot access unix domain socket | ||
# created by privileged CSI driver container. | ||
privileged: true | ||
volumeMounts: | ||
- mountPath: /csi | ||
name: socket-dir | ||
volumes: | ||
- hostPath: | ||
path: /var/lib/kubelet/plugins/csi-hostpath | ||
type: DirectoryOrCreate | ||
name: socket-dir |
4 changes: 4 additions & 0 deletions
4
charts/internal/seed-controlplane/charts/csi-hostpath/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
images: | ||
csi-attacher: image-repository:image-tag | ||
csi-provisioner: image-repository:image-tag | ||
csi-resizer: image-repository:image-tag |
11 changes: 11 additions & 0 deletions
11
charts/internal/shoot-storageclasses/templates/hostpath-storageclass.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: csi-hostpath-sc | ||
annotations: | ||
storageclass.kubernetes.io/is-default-class: "true" | ||
provisioner: hostpath.csi.k8s.io | ||
reclaimPolicy: Delete | ||
volumeBindingMode: Immediate | ||
allowVolumeExpansion: true |
4 changes: 4 additions & 0 deletions
4
charts/internal/shoot-system-components/charts/csi-hostpath/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
description: a hostpath provisioner for shoot control plane | ||
name: hostpath-provisioner | ||
version: 0.1.0 |
77 changes: 77 additions & 0 deletions
77
charts/internal/shoot-system-components/charts/csi-hostpath/templates/csi-attacher-rbac.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# This YAML file contains all RBAC objects that are necessary to run external | ||
# CSI attacher. | ||
# | ||
# In production, each CSI driver deployment has to be customized: | ||
# - to avoid conflicts, use non-default namespace and different names | ||
# for non-namespaced entities like the ClusterRole | ||
# - decide whether the deployment replicates the external CSI | ||
# attacher, in which case leadership election must be enabled; | ||
# this influences the RBAC setup, see below | ||
|
||
# Attacher must be able to work with PVs, nodes and VolumeAttachments | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: gardener.cloud:csi-attacher | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch", "update"] | ||
{{- if semverCompare "< 1.14" .Values.kubernetesVersion }} | ||
- apiGroups: ["csi.storage.k8s.io"] | ||
resources: ["csinodeinfos"] | ||
verbs: ["get", "list", "watch"] | ||
{{- else }} | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["csinodes"] | ||
verbs: ["get", "list", "watch"] | ||
{{- end }} | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["volumeattachments"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["create", "patch", "update"] | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: gardener.cloud:csi-attacher | ||
subjects: | ||
- kind: User | ||
name: system:csi-attacher | ||
roleRef: | ||
kind: ClusterRole | ||
name: gardener.cloud:csi-attacher | ||
apiGroup: rbac.authorization.k8s.io | ||
|
||
{{- if semverCompare ">= 1.14" .Values.kubernetesVersion }} | ||
--- | ||
# Attacher must be able to work with config map in current namespace | ||
# if (and only if) leadership election is enabled | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
namespace: kube-system | ||
name: csi-attacher | ||
rules: | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["get", "watch", "list", "delete", "update", "create"] | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: csi-attacher | ||
namespace: kube-system | ||
subjects: | ||
- kind: User | ||
name: system:csi-attacher | ||
roleRef: | ||
kind: Role | ||
name: csi-attacher | ||
apiGroup: rbac.authorization.k8s.io | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
...ternal/shoot-system-components/charts/csi-hostpath/templates/csi-hostpath-driverinfo.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: storage.k8s.io/v1beta1 | ||
kind: CSIDriver | ||
metadata: | ||
name: hostpath.csi.k8s.io | ||
spec: | ||
# Supports persistent and ephemeral inline volumes. | ||
volumeLifecycleModes: | ||
- Persistent | ||
- Ephemeral | ||
# To determine at runtime which mode a volume uses, pod info and its | ||
# "csi.storage.k8s.io/ephemeral" entry are needed. | ||
podInfoOnMount: true |
Oops, something went wrong.