forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Openstack] Cleanup the old in-tree openstack cloud provider (kuberne…
…tes-sigs#5742) * Added playbook to migrate openstack cloud provider * remove old cloud provider config * Rewrite provisioned-by annotation on Cinder PVs * update indents Co-authored-by: Jonathan Süssemilch Poulain <[email protected]>
- Loading branch information
1 parent
a3dedb6
commit 833794f
Showing
2 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
kubectl get pv -o go-template --template='{{ range .items }}{{ $metadata := .metadata }}{{ with $value := index .metadata.annotations "pv.kubernetes.io/provisioned-by" }}{{ if eq $value "kubernetes.io/cinder" }}{{printf "%s\n" $metadata.name}}{{ end }}{{ end }}{{ end }}' |
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,28 @@ | ||
--- | ||
- hosts: kube-node:kube-master | ||
tasks: | ||
- name: Remove old cloud provider config | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- /etc/kubernetes/cloud_config | ||
- hosts: kube-master[0] | ||
tasks: | ||
- name: Include kubespray-default variables | ||
include_vars: ../roles/kubespray-defaults/defaults/main.yaml | ||
- name: Copy get_cinder_pvs.sh to master | ||
copy: | ||
src: get_cinder_pvs.sh | ||
dest: /tmp | ||
mode: u+rwx | ||
- name: Get PVs provisioned by in-tree cloud provider | ||
command: /tmp/get_cinder_pvs.sh | ||
register: pvs | ||
- name: Remove get_cinder_pvs.sh | ||
file: | ||
path: /tmp/get_cinder_pvs.sh | ||
state: absent | ||
- name: Rewrite the "pv.kubernetes.io/provisioned-by" annotation | ||
command: "{{ bin_dir }}/kubectl annotate --overwrite pv {{ item }} pv.kubernetes.io/provisioned-by=cinder.csi.openstack.org" | ||
loop: "{{ pvs.stdout_lines | list }}" |