diff --git a/deploy/install.yaml b/deploy/install.yaml index a3639c3..de3ff3e 100644 --- a/deploy/install.yaml +++ b/deploy/install.yaml @@ -148,6 +148,46 @@ roleRef: name: external-resizer-runner apiGroup: rbac.authorization.k8s.io --- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: external-snapshotter-runner +rules: + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotcontents"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotcontents/status"] + verbs: ["update", "patch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotcontents"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotcontents/status"] + verbs: ["update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-snapshotter-role +subjects: + - kind: ServiceAccount + name: civo-csi-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: external-snapshotter-runner + apiGroup: rbac.authorization.k8s.io +--- apiVersion: storage.k8s.io/v1 kind: CSIDriver metadata: @@ -225,7 +265,7 @@ spec: - name: socket-dir mountPath: /var/lib/kubelet/plugins/csi.civo.com - name: csi-resizer - image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0 + image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -237,6 +277,19 @@ spec: volumeMounts: - name: socket-dir mountPath: /var/lib/kubelet/plugins/csi.civo.com + - name: csi-snapshotter + image: k8s.gcr.io/sig-storage/csi-snapshotter:v8.1.0 + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + - "--timeout=30s" + env: + - name: ADDRESS + value: /var/lib/kubelet/plugins/csi.civo.com/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/kubelet/plugins/csi.civo.com - name: civo-csi-plugin image: gcr.io/consummate-yew-302509/csi:latest env: diff --git a/deploy/kubernetes/01_rbac.yaml b/deploy/kubernetes/01_rbac.yaml index cfbaaa7..11ff404 100644 --- a/deploy/kubernetes/01_rbac.yaml +++ b/deploy/kubernetes/01_rbac.yaml @@ -147,3 +147,43 @@ roleRef: kind: ClusterRole name: external-resizer-runner apiGroup: rbac.authorization.k8s.io +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: external-snapshotter-runner +rules: + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotcontents"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotcontents/status"] + verbs: ["update", "patch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotcontents"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["groupsnapshot.storage.k8s.io"] + resources: ["volumegroupsnapshotcontents/status"] + verbs: ["update", "patch"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-snapshotter-role +subjects: + - kind: ServiceAccount + name: civo-csi-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: external-snapshotter-runner + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/kubernetes/04_controller.yaml b/deploy/kubernetes/04_controller.yaml index ce03016..237394d 100644 --- a/deploy/kubernetes/04_controller.yaml +++ b/deploy/kubernetes/04_controller.yaml @@ -58,7 +58,7 @@ spec: - name: socket-dir mountPath: /var/lib/kubelet/plugins/csi.civo.com - name: csi-resizer - image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0 + image: k8s.gcr.io/sig-storage/csi-resizer:v1.4.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -70,6 +70,19 @@ spec: volumeMounts: - name: socket-dir mountPath: /var/lib/kubelet/plugins/csi.civo.com + - name: csi-snapshotter + image: k8s.gcr.io/sig-storage/csi-snapshotter:v8.1.0 + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + - "--timeout=30s" + env: + - name: ADDRESS + value: /var/lib/kubelet/plugins/csi.civo.com/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/kubelet/plugins/csi.civo.com - name: civo-csi-plugin image: gcr.io/consummate-yew-302509/csi:latest env: diff --git a/deploy/kubernetes/kustomization.yaml b/deploy/kubernetes/kustomization.yaml new file mode 100644 index 0000000..1ca78ce --- /dev/null +++ b/deploy/kubernetes/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - snapshot-controller + + # For CSI driver + - 01_rbac.yaml + - 02_csi_driver.yaml + - 03_storage_class.yaml + - 04_controller.yaml + - 05_node.yaml diff --git a/deploy/kubernetes/snapshot-controller/kustomization.yaml b/deploy/kubernetes/snapshot-controller/kustomization.yaml new file mode 100644 index 0000000..31efddf --- /dev/null +++ b/deploy/kubernetes/snapshot-controller/kustomization.yaml @@ -0,0 +1,19 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + # For CRD + - https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml + - https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml + - https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.1/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml + + ## For snapshot-controller + - https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.0.1/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml + - https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.0.1/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml + + # For VolumeSnapshotClass + - volume_snapshot_class.yaml + +images: + - name: registry.k8s.io/sig-storage/snapshot-controller:v7.0.1 + newName: k8s.gcr.io/sig-storage/snapshot-controller + newTag: v8.0.1 diff --git a/deploy/kubernetes/snapshot-controller/volume_snapshot_class.yaml b/deploy/kubernetes/snapshot-controller/volume_snapshot_class.yaml new file mode 100644 index 0000000..4bc7a5a --- /dev/null +++ b/deploy/kubernetes/snapshot-controller/volume_snapshot_class.yaml @@ -0,0 +1,6 @@ +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotClass +metadata: + name: civo-volume-snapshot +driver: csi.civo.com +deletionPolicy: Delete