-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a destroy-script for the resources installed #216
added a destroy-script for the resources installed #216
Conversation
Hi @aayushrangwala. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
24e6f50
to
2aa6e5d
Compare
/cc @pohly |
deploy/util/destroy-hostpath.sh
Outdated
|
||
BASE_DIR=$(dirname "$0") | ||
|
||
LABELS=(csi-snapshotter csi-hostpathplugin csi-attacher csi-resizer csi-hostpath-driver csi-provisioner csi-hostpath-socat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The labels have to be specific to the hostpath deployment. We cannot risk deleting something that may be part of some other CSI driver deployment.
The setup script has to add those labels instead of assuming that the sidecar RBAC objects already have certain labels. When the script was originally written, kustomize was still new. It might be possible to rely on the kustomize in kubectl >= 1.17 to add labels. Even the image selection might now be done that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Makes more sense. I believe using kustomize across the project is in the scope of another ticket. But I will note your point and change the labels and maybe create a new pr for the kustomize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved them. Please re-review
2aa6e5d
to
b96a027
Compare
.gitignore
Outdated
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In your next push, please also clean up your commit:
- don't change .gitignore
- use a commit message that has a subject line and a body (separated by blank line) which explains what this is about and why the change is relevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aayushrangwala do you want to finish this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pohly Yeah, I will wrap this up. Got stuck in something completely unavoidable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaned commit
b96a027
to
8ed7de5
Compare
8ed7de5
to
e3cd8e2
Compare
0ab8133
to
c063ce5
Compare
deploy/util/deploy-hostpath.sh
Outdated
|
||
if [[ "${current}" =~ ^http:// ]] || [[ "${current}" =~ ^https:// ]]; then | ||
curl "${current}" --output rbac.yaml --silent --location | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and this rbac.yaml
gets used where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment about why downloading that file with curl is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. Skipped one commit to push. Will add the comment as well and push again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update deploy/kubernetes-distributed?
The deploy.sh script there is a fork, but your changes apply with some offsets:
$ git diff origin/master..HEAD deploy/util/deploy-hostpath.sh | patch deploy/kubernetes-distributed/deploy.sh
patching file deploy/kubernetes-distributed/deploy.sh
Hunk #1 succeeded at 13 with fuzz 2 (offset -14 lines).
Hunk #2 succeeded at 137 with fuzz 1 (offset -31 lines).
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those labels also should be set inside the PodSpec, otherwise kubectl get all -l app.kubernetes.io/instance=hostpath.csi.k8s.io
returns an incomplete result.
I think it is okay to use the same key/value pairs as for the StatefulSet itself.
The same change is needed also for the other StatefulSets and DaemonSets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense it will make the child pods for the app object distinguishable
deploy/util/deploy-hostpath.sh
Outdated
@@ -164,7 +168,30 @@ for component in CSI_PROVISIONER CSI_ATTACHER CSI_SNAPSHOTTER CSI_RESIZER CSI_EX | |||
echo "Using non-default RBAC rules for $component. Changes from $original to $current are:" | |||
diff -c <(wget --quiet -O - "$original") <(if [[ "$current" =~ ^http ]]; then wget --quiet -O - "$current"; else cat "$current"; fi) || true | |||
fi | |||
run kubectl apply -f "${current}" | |||
|
|||
echo "adding labels to rbac" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran this script and did not fine this line useful. Can you remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
deploy/util/deploy-hostpath.sh
Outdated
# since we are deploying rbas directly with the url, the kustomize plugin only works with the local files | ||
# we need to add the files locally in temp folder and using kustomize adding labels it will be applied | ||
if [[ "${current}" =~ ^http:// ]] || [[ "${current}" =~ ^https:// ]]; then | ||
curl "${current}" --output "${TEMP_DIR}"/rbac.yaml --silent --location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More important is to wrap this with run
, because then it will be obvious what failed if curl prints error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right.
c8ecbb5
to
1656581
Compare
1656581
to
cabad3b
Compare
/retest |
a7b54f3
to
68ac347
Compare
/retest |
80a5cc0
to
b0e2723
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last fix and then it should be ready.
Please also squash all commits.
# kubectl maintains a few standard resources under "all" category which can be deleted by using just "kubectl delete all" | ||
# and other resources such as roles, clusterrole, serivceaccount etc needs to be deleted explicitly | ||
kubectl delete all --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io,app.kubernetes.io/part-of=csi-driver-host-path --wait=true | ||
kubectl delete role,clusterrole,rolebinding,clusterrolebinding,serviceaccount,storageclass --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io,app.kubernetes.io/part-of=csi-driver-host-path --wait=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
csidriver
must be added here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…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
b0e2723
to
03204df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Thanks for the contribution.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aayushrangwala, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae99 Update k8s image repo url 77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b Fix dep version mismatch 8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94d Update go version to 1.20 to match k/k v1.27 e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a512 test: fix golint error aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171be Merge pull request kubernetes-csi#216 from msau42/process cb98782 Merge pull request kubernetes-csi#217 from msau42/owners a11216e add new reviewers and remove inactive reviewers dd98675 Add step for checking builds git-subtree-dir: release-tools git-subtree-split: 6613c39
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae99 Update k8s image repo url 77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b Fix dep version mismatch 8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94d Update go version to 1.20 to match k/k v1.27 e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a512 test: fix golint error aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171be Merge pull request kubernetes-csi#216 from msau42/process cb98782 Merge pull request kubernetes-csi#217 from msau42/owners a11216e add new reviewers and remove inactive reviewers dd98675 Add step for checking builds git-subtree-dir: release-tools git-subtree-split: 6613c39
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae99 Update k8s image repo url 77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b Fix dep version mismatch 8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94d Update go version to 1.20 to match k/k v1.27 e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a512 test: fix golint error aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171be Merge pull request kubernetes-csi#216 from msau42/process cb98782 Merge pull request kubernetes-csi#217 from msau42/owners a11216e add new reviewers and remove inactive reviewers dd98675 Add step for checking builds git-subtree-dir: release-tools git-subtree-split: 6613c39
Add step for checking builds
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Need a cleanup script to delete all the installed resources
Which issue(s) this PR fixes:
Fixes #212
Does this PR introduce a user-facing change?:
NONE