Skip to content

Commit

Permalink
Add a script to remove all the resources deployed as the part of CSI …
Browse files Browse the repository at this point in the history
…Driver

- added a version specific destroy script parallel to deploy-script

- added labels to all the resources of csi deployment along with the podSpec template label-selector

- added labels to rbac files on the fly locally in /tmp/* folder to be able to track using kustomize

- cleanup gitignore

- Useful to cleanup the resources which can interfere with the redeployments or on some automations based
on the Driver deployment
  • Loading branch information
aayushrangwala authored and Ayush Rangwala committed May 3, 2021
1 parent d0d44ab commit 03204df
Show file tree
Hide file tree
Showing 28 changed files with 400 additions and 53 deletions.
1 change: 1 addition & 0 deletions deploy/kubernetes-1.18/destroy.sh
17 changes: 14 additions & 3 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-attacher
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
spec:
serviceName: "csi-hostpath-attacher"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-attacher
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
template:
metadata:
labels:
app: csi-hostpath-attacher
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- csi-hostpathplugin
Expand Down
5 changes: 5 additions & 0 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-driverinfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: hostpath.csi.k8s.io
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: hostpath.csi.k8s.io
app.kubernetes.io/component: csi-driver
spec:
# Supports persistent and ephemeral inline volumes.
volumeLifecycleModes:
Expand Down
25 changes: 21 additions & 4 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ apiVersion: v1
metadata:
name: csi-hostpathplugin
labels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
selector:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
ports:
- name: dummy
port: 12345
Expand All @@ -19,6 +25,11 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpathplugin
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
serviceName: "csi-hostpathplugin"
# One replica only:
Expand All @@ -28,11 +39,17 @@ spec:
replicas: 1
selector:
matchLabels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
template:
metadata:
labels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
serviceAccountName: csi-external-health-monitor-controller
containers:
Expand Down
17 changes: 14 additions & 3 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-provisioner
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-provisioner
app.kubernetes.io/component: provisioner
spec:
serviceName: "csi-hostpath-provisioner"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-provisioner
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-provisioner
app.kubernetes.io/component: provisioner
template:
metadata:
labels:
app: csi-hostpath-provisioner
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-provisioner
app.kubernetes.io/component: provisioner
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- csi-hostpathplugin
Expand Down
17 changes: 14 additions & 3 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-resizer
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-resizer
app.kubernetes.io/component: resizer
spec:
serviceName: "csi-hostpath-resizer"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-resizer
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-resizer
app.kubernetes.io/component: resizer
template:
metadata:
labels:
app: csi-hostpath-resizer
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-resizer
app.kubernetes.io/component: resizer
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- csi-hostpathplugin
Expand Down
17 changes: 14 additions & 3 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-snapshotter
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-snapshotter
app.kubernetes.io/component: snapshotter
spec:
serviceName: "csi-hostpath-snapshotter"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-snapshotter
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-snapshotter
app.kubernetes.io/component: snapshotter
template:
metadata:
labels:
app: csi-hostpath-snapshotter
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-snapshotter
app.kubernetes.io/component: snapshotter
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- csi-hostpathplugin
Expand Down
27 changes: 23 additions & 4 deletions deploy/kubernetes-1.18/hostpath/csi-hostpath-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,53 @@ apiVersion: v1
kind: Service
metadata:
name: hostpath-service
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-socat
app.kubernetes.io/component: socat
spec:
type: NodePort
selector:
app: csi-hostpath-socat
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-socat
app.kubernetes.io/component: socat
ports:
- port: 10000 # fixed port inside the pod, dynamically allocated port outside
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-socat
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-socat
app.kubernetes.io/component: socat
spec:
serviceName: "csi-hostpath-socat"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-socat
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-socat
app.kubernetes.io/component: socat
template:
metadata:
labels:
app: csi-hostpath-socat
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-socat
app.kubernetes.io/component: socat
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- csi-hostpathplugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshotClass
metadata:
name: csi-hostpath-snapclass
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-snapclass
app.kubernetes.io/component: volumesnapshotclass
driver: hostpath.csi.k8s.io #csi-hostpath
deletionPolicy: Delete
1 change: 1 addition & 0 deletions deploy/kubernetes-1.20/destroy.sh
19 changes: 15 additions & 4 deletions deploy/kubernetes-1.20/hostpath/csi-hostpath-attacher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,37 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpath-attacher
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
spec:
serviceName: "csi-hostpath-attacher"
replicas: 1
selector:
matchLabels:
app: csi-hostpath-attacher
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
template:
metadata:
labels:
app: csi-hostpath-attacher
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpath-attacher
app.kubernetes.io/component: attacher
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/instance
operator: In
values:
- csi-hostpathplugin
- hostpath.csi.k8s.io
topologyKey: kubernetes.io/hostname
serviceAccountName: csi-attacher
containers:
Expand Down
5 changes: 5 additions & 0 deletions deploy/kubernetes-1.20/hostpath/csi-hostpath-driverinfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: hostpath.csi.k8s.io
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: hostpath.csi.k8s.io
app.kubernetes.io/component: csi-driver
spec:
# Supports persistent and ephemeral inline volumes.
volumeLifecycleModes:
Expand Down
20 changes: 17 additions & 3 deletions deploy/kubernetes-1.20/hostpath/csi-hostpath-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ apiVersion: v1
metadata:
name: csi-hostpathplugin
labels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
selector:
app: csi-hostpathplugin
Expand All @@ -19,6 +22,11 @@ kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpathplugin
labels:
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
serviceName: "csi-hostpathplugin"
# One replica only:
Expand All @@ -28,11 +36,17 @@ spec:
replicas: 1
selector:
matchLabels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
template:
metadata:
labels:
app: csi-hostpathplugin
app.kubernetes.io/instance: hostpath.csi.k8s.io
app.kubernetes.io/part-of: csi-driver-host-path
app.kubernetes.io/name: csi-hostpathplugin
app.kubernetes.io/component: plugin
spec:
serviceAccountName: csi-external-health-monitor-controller
containers:
Expand Down
Loading

0 comments on commit 03204df

Please sign in to comment.