diff --git a/nfs-backup-storage-intelligent/class.yaml b/nfs-backup-storage-intelligent/class.yaml new file mode 100644 index 0000000..04c065f --- /dev/null +++ b/nfs-backup-storage-intelligent/class.yaml @@ -0,0 +1,8 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: nfs-storage-backup +provisioner: k8s-sigs.io/nfs-subdir-external-provisioner-backup # or choose another name, must match deployment's env PROVISIONER_NAME' +parameters: + archiveOnDelete: "false" + pathPattern: "Backup/${.PVC.namespace}/${.PVC.name}" diff --git a/nfs-backup-storage-intelligent/deployment.yaml b/nfs-backup-storage-intelligent/deployment.yaml new file mode 100644 index 0000000..8521809 --- /dev/null +++ b/nfs-backup-storage-intelligent/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nfs-client-provisioner + labels: + app: nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: nfs-client-provisioner + template: + metadata: + labels: + app: nfs-client-provisioner + spec: + serviceAccountName: nfs-client-provisioner-backup + containers: + - name: nfs-client-provisioner + image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 + volumeMounts: + - name: nfs-client-root + mountPath: /persistentvolumes + env: + - name: PROVISIONER_NAME + value: k8s-sigs.io/nfs-subdir-external-provisioner-backup + - name: NFS_SERVER + value: 192.168.88.50 + - name: NFS_PATH + value: /data/kubernetes + volumes: + - name: nfs-client-root + nfs: + server: 192.168.88.50 + path: /data/kubernetes diff --git a/nfs-backup-storage-intelligent/kustomization.yaml b/nfs-backup-storage-intelligent/kustomization.yaml new file mode 100644 index 0000000..cb81386 --- /dev/null +++ b/nfs-backup-storage-intelligent/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - class.yaml + - rbac.yaml + - deployment.yaml diff --git a/nfs-backup-storage-intelligent/namespace.yaml b/nfs-backup-storage-intelligent/namespace.yaml new file mode 100644 index 0000000..b8aa7de --- /dev/null +++ b/nfs-backup-storage-intelligent/namespace.yaml @@ -0,0 +1,5 @@ +# namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: nfs-provisioner-backup diff --git a/nfs-backup-storage-intelligent/rbac.yaml b/nfs-backup-storage-intelligent/rbac.yaml new file mode 100644 index 0000000..d52ff72 --- /dev/null +++ b/nfs-backup-storage-intelligent/rbac.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nfs-client-provisioner-backup + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nfs-client-provisioner-runner +rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - 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: ["create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: run-nfs-client-provisioner-backup +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-backup + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +roleRef: + kind: ClusterRole + name: nfs-client-provisioner-runner + apiGroup: rbac.authorization.k8s.io +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +rules: + - apiGroups: [""] + resources: ["endpoints"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-backup + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-backup +roleRef: + kind: Role + name: leader-locking-nfs-client-provisioner + apiGroup: rbac.authorization.k8s.io diff --git a/nfs-backup-storage-intelligent/test-claim.yaml b/nfs-backup-storage-intelligent/test-claim.yaml new file mode 100644 index 0000000..291d3f0 --- /dev/null +++ b/nfs-backup-storage-intelligent/test-claim.yaml @@ -0,0 +1,43 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-fastaccess + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim2 + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim3 + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-backup + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- diff --git a/nfs-storage-fastaccess/class.yaml b/nfs-storage-fastaccess/class.yaml new file mode 100644 index 0000000..fe04bb3 --- /dev/null +++ b/nfs-storage-fastaccess/class.yaml @@ -0,0 +1,8 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: nfs-storage-fastaccess +provisioner: k8s-sigs.io/nfs-subdir-external-provisioner-fastaccess # or choose another name, must match deployment's env PROVISIONER_NAME' +parameters: + archiveOnDelete: "false" + pathPattern: "${.PVC.annotations.fileType}/${.PVC.namespace}/${.PVC.name}" diff --git a/nfs-storage-fastaccess/deployment.yaml b/nfs-storage-fastaccess/deployment.yaml new file mode 100644 index 0000000..c48eb28 --- /dev/null +++ b/nfs-storage-fastaccess/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nfs-client-provisioner + labels: + app: nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: nfs-client-provisioner + template: + metadata: + labels: + app: nfs-client-provisioner + spec: + serviceAccountName: nfs-client-provisioner-fastaccess + containers: + - name: nfs-client-provisioner + image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 + volumeMounts: + - name: nfs-client-root + mountPath: /persistentvolumes + env: + - name: PROVISIONER_NAME + value: k8s-sigs.io/nfs-subdir-external-provisioner-fastaccess + - name: NFS_SERVER + value: 192.168.88.50 + - name: NFS_PATH + value: /ssd + volumes: + - name: nfs-client-root + nfs: + server: 192.168.88.50 + path: /ssd diff --git a/nfs-storage-fastaccess/kustomization.yaml b/nfs-storage-fastaccess/kustomization.yaml new file mode 100644 index 0000000..cb81386 --- /dev/null +++ b/nfs-storage-fastaccess/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - class.yaml + - rbac.yaml + - deployment.yaml diff --git a/nfs-storage-fastaccess/namespace.yaml b/nfs-storage-fastaccess/namespace.yaml new file mode 100644 index 0000000..261904d --- /dev/null +++ b/nfs-storage-fastaccess/namespace.yaml @@ -0,0 +1,5 @@ +# namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: nfs-provisioner-ssd diff --git a/nfs-storage-fastaccess/rbac.yaml b/nfs-storage-fastaccess/rbac.yaml new file mode 100644 index 0000000..7abd615 --- /dev/null +++ b/nfs-storage-fastaccess/rbac.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nfs-client-provisioner-fastaccess + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nfs-client-provisioner-runner +rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - 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: ["create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: run-nfs-client-provisioner-fastaccess +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-fastaccess + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +roleRef: + kind: ClusterRole + name: nfs-client-provisioner-runner + apiGroup: rbac.authorization.k8s.io +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +rules: + - apiGroups: [""] + resources: ["endpoints"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-fastaccess + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-ssd +roleRef: + kind: Role + name: leader-locking-nfs-client-provisioner + apiGroup: rbac.authorization.k8s.io diff --git a/nfs-storage-fastaccess/test-claim.yaml b/nfs-storage-fastaccess/test-claim.yaml new file mode 100644 index 0000000..c2b9336 --- /dev/null +++ b/nfs-storage-fastaccess/test-claim.yaml @@ -0,0 +1,29 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-fastaccess + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim2 + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- diff --git a/nfs-storage-intelligent/class.yaml b/nfs-storage-intelligent/class.yaml new file mode 100644 index 0000000..8c164cf --- /dev/null +++ b/nfs-storage-intelligent/class.yaml @@ -0,0 +1,8 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: nfs-storage-intelligent +provisioner: k8s-sigs.io/nfs-subdir-external-provisioner-intelligent # or choose another name, must match deployment's env PROVISIONER_NAME' +parameters: + archiveOnDelete: "false" + pathPattern: "${.PVC.namespace}/${.PVC.name}" diff --git a/nfs-storage-intelligent/deployment.yaml b/nfs-storage-intelligent/deployment.yaml new file mode 100644 index 0000000..c4bcc20 --- /dev/null +++ b/nfs-storage-intelligent/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nfs-client-provisioner + labels: + app: nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: nfs-client-provisioner + template: + metadata: + labels: + app: nfs-client-provisioner + spec: + serviceAccountName: nfs-client-provisioner-intelligent + containers: + - name: nfs-client-provisioner + image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 + volumeMounts: + - name: nfs-client-root + mountPath: /persistentvolumes + env: + - name: PROVISIONER_NAME + value: k8s-sigs.io/nfs-subdir-external-provisioner-intelligent + - name: NFS_SERVER + value: 192.168.88.50 + - name: NFS_PATH + value: /data/kubernetes + volumes: + - name: nfs-client-root + nfs: + server: 192.168.88.50 + path: /data/kubernetes diff --git a/nfs-storage-intelligent/kustomization.yaml b/nfs-storage-intelligent/kustomization.yaml new file mode 100644 index 0000000..cb81386 --- /dev/null +++ b/nfs-storage-intelligent/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - class.yaml + - rbac.yaml + - deployment.yaml diff --git a/nfs-storage-intelligent/namespace.yaml b/nfs-storage-intelligent/namespace.yaml new file mode 100644 index 0000000..a161d1f --- /dev/null +++ b/nfs-storage-intelligent/namespace.yaml @@ -0,0 +1,5 @@ +# namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: nfs-provisioner-intelligent diff --git a/nfs-storage-intelligent/rbac.yaml b/nfs-storage-intelligent/rbac.yaml new file mode 100644 index 0000000..d768432 --- /dev/null +++ b/nfs-storage-intelligent/rbac.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: nfs-client-provisioner-intelligent + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nfs-client-provisioner-runner +rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - 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: ["create", "update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: run-nfs-client-provisioner-intelligent +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-intelligent + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +roleRef: + kind: ClusterRole + name: nfs-client-provisioner-runner + apiGroup: rbac.authorization.k8s.io +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +rules: + - apiGroups: [""] + resources: ["endpoints"] + verbs: ["get", "list", "watch", "create", "update", "patch"] +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: leader-locking-nfs-client-provisioner + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +subjects: + - kind: ServiceAccount + name: nfs-client-provisioner-intelligent + # replace with namespace where provisioner is deployed + namespace: nfs-provisioner-intelligent +roleRef: + kind: Role + name: leader-locking-nfs-client-provisioner + apiGroup: rbac.authorization.k8s.io diff --git a/nfs-storage-intelligent/test-claim.yaml b/nfs-storage-intelligent/test-claim.yaml new file mode 100644 index 0000000..c2b9336 --- /dev/null +++ b/nfs-storage-intelligent/test-claim.yaml @@ -0,0 +1,29 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-fastaccess + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +--- + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: test-claim2 + annotations: + fileType : "test" +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Mi +---