-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from andyzhangx/storage-class-support
feat: Storage class support
- Loading branch information
Showing
18 changed files
with
284 additions
and
27 deletions.
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
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
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,100 @@ | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: csi-smb-controller | ||
namespace: kube-system | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: csi-smb-controller | ||
template: | ||
metadata: | ||
labels: | ||
app: csi-smb-controller | ||
spec: | ||
serviceAccountName: csi-smb-controller-sa | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
priorityClassName: system-cluster-critical | ||
tolerations: | ||
- key: "node-role.kubernetes.io/master" | ||
operator: "Equal" | ||
value: "true" | ||
effect: "NoSchedule" | ||
containers: | ||
- name: csi-provisioner | ||
image: mcr.microsoft.com/oss/kubernetes-csi/csi-provisioner:v1.4.0 | ||
args: | ||
- "-v=5" | ||
- "--csi-address=$(ADDRESS)" | ||
- "--enable-leader-election" | ||
- "--leader-election-type=leases" | ||
env: | ||
- name: ADDRESS | ||
value: /csi/csi.sock | ||
volumeMounts: | ||
- mountPath: /csi | ||
name: socket-dir | ||
resources: | ||
limits: | ||
cpu: 1 | ||
memory: 1Gi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
- name: liveness-probe | ||
image: mcr.microsoft.com/oss/kubernetes-csi/livenessprobe:v1.1.0 | ||
args: | ||
- --csi-address=/csi/csi.sock | ||
- --connection-timeout=3s | ||
- --health-port=29632 | ||
- --v=5 | ||
volumeMounts: | ||
- name: socket-dir | ||
mountPath: /csi | ||
resources: | ||
limits: | ||
cpu: 1 | ||
memory: 1Gi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
- name: smb | ||
image: mcr.microsoft.com/k8s/csi/smb-csi:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- "--v=5" | ||
- "--endpoint=$(CSI_ENDPOINT)" | ||
ports: | ||
- containerPort: 29632 | ||
name: healthz | ||
protocol: TCP | ||
- containerPort: 29634 | ||
name: metrics | ||
protocol: TCP | ||
livenessProbe: | ||
failureThreshold: 5 | ||
httpGet: | ||
path: /healthz | ||
port: healthz | ||
initialDelaySeconds: 30 | ||
timeoutSeconds: 10 | ||
periodSeconds: 30 | ||
env: | ||
- name: CSI_ENDPOINT | ||
value: unix:///csi/csi.sock | ||
volumeMounts: | ||
- mountPath: /csi | ||
name: socket-dir | ||
resources: | ||
limits: | ||
cpu: 1 | ||
memory: 1Gi | ||
requests: | ||
cpu: 10m | ||
memory: 20Mi | ||
volumes: | ||
- name: socket-dir | ||
emptyDir: {} |
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
File renamed without changes.
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 @@ | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: pvc-smb | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
storageClassName: smb |
File renamed without changes.
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
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,40 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: statefulset-smb | ||
labels: | ||
app: nginx | ||
spec: | ||
serviceName: statefulset-smb | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: statefulset-smb | ||
image: nginx | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- while true; do echo $(date) >> /mnt/smb/outfile; sleep 1; done | ||
volumeMounts: | ||
- name: persistent-storage | ||
mountPath: /mnt/smb | ||
updateStrategy: | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: persistent-storage | ||
annotations: | ||
volume.beta.kubernetes.io/storage-class: smb | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 10Gi |
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,17 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: smb | ||
provisioner: smb.csi.k8s.io | ||
parameters: | ||
source: "//smb-server.default.svc.cluster.local/share" | ||
csi.storage.k8s.io/node-stage-secret-name: "smbcreds" | ||
csi.storage.k8s.io/node-stage-secret-namespace: "default" | ||
reclaimPolicy: Retain # only retain is supported | ||
volumeBindingMode: Immediate | ||
mountOptions: | ||
- dir_mode=0777 | ||
- file_mode=0777 | ||
- uid=1001 | ||
- gid=1001 |
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
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,49 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: csi-smb-controller-sa | ||
namespace: kube-system | ||
|
||
--- | ||
|
||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: smb-external-provisioner-role | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "create", "delete"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumeclaims"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["storageclasses"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["csinodes"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
--- | ||
|
||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: smb-csi-provisioner-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: csi-smb-controller-sa | ||
namespace: kube-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: smb-external-provisioner-role | ||
apiGroup: rbac.authorization.k8s.io |
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
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
## `smb.csi.k8s.io` driver parameters | ||
This driver only supports static provisioning | ||
> This driver only supports static provisioning, bring your own Samba server before using this driver. | ||
### Storage Class Usage | ||
> get a quick example [here](../deploy/example/storageclass-smb.yaml) | ||
- Static Provision(use existing smb) | ||
> get a quick example [here](../deploy/example/pv-smb-csi.yaml) | ||
Name | Meaning | Available Value | Mandatory | Default value | ||
--- | --- | --- | --- | --- | ||
source | Samba Server address | `//smb-server-address/sharename`(for [Azure File](https://docs.microsoft.com/en-us/azure/storage/files/storage-files-introduction), format is `//accountname.file.core.windows.net/filesharename`) | Yes | | ||
csi.storage.k8s.io/node-stage-secret-name | secret name that stores `username`, `password`(`domain` is optional) | existing secret name | Yes | | ||
csi.storage.k8s.io/node-stage-secret-namespace | namespace where the secret is | k8s namespace | Yes | | ||
|
||
### PV/PVC Usage | ||
> get a quick example [here](../deploy/example/pv-smb.yaml) | ||
Name | Meaning | Available Value | Mandatory | Default value | ||
--- | --- | --- | --- | --- | ||
volumeAttributes.source | SMB server address | `//IP/smb-server/directory`(for azure file, format is `//accountname.file.core.windows.net/filesharename`) | Yes | | ||
nodeStageSecretRef.name | secret name that stores `username`, `password` | existing secret name | Yes | | ||
nodeStageSecretRef.namespace | namespace where the secret is | k8s namespace | No | `default` | ||
volumeAttributes.source | Samba Server address | `//smb-server-address/sharename`(for [Azure File](https://docs.microsoft.com/en-us/azure/storage/files/storage-files-introduction), format is `//accountname.file.core.windows.net/filesharename`) | Yes | | ||
nodeStageSecretRef.name | secret name that stores `username`, `password`(`domain` is optional) | existing secret name | Yes | | ||
nodeStageSecretRef.namespace | namespace where the secret is | k8s namespace | Yes | |
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
Oops, something went wrong.