Skip to content

Commit

Permalink
fixup! Refactor upgrade tests for k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
lentzi90 committed Jul 1, 2021
1 parent 6cd30cf commit f6665bb
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions vm-setup/roles/v1aX_integration_test/tasks/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,29 @@
KUBECONFIG: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
ignore_errors: yes

# TODO: Could we use etcdctl to check this?
- name: Get control plane nodes
community.kubernetes.k8s_info:
api_version: v1
kind: Node
kubeconfig: "/tmp/kubeconfig-{{ CLUSTER_NAME }}.yaml"
label_selectors:
- node-role.kubernetes.io/control-plane=
register: control_plane_nodes

- name: Wait for old etcd instance to leave the new etcd-cluster
pause:
minutes: 10
community.kubernetes.k8s_exec:
namespace: kube-system
pod: etcd-{{ control_plane_nodes.resources[0].metadata.name }}
command: >
etcdctl member list --write-out json
--cacert /etc/kubernetes/pki/etcd/ca.crt
--key /etc/kubernetes/pki/etcd/server.key
--cert /etc/kubernetes/pki/etcd/server.crt
register: etcdctl
# The list of control plane nodes and etcd members should match
until: (etcdctl is succeeded) and
((etcdctl.stdout | from_json).members | map(attribute='name') | sort ==
(control_plane_nodes.resources | map(attribute='metadata.name') | sort) )

- name: Verify that the old controlplane node has left the cluster
community.kubernetes.k8s_info:
Expand All @@ -379,10 +398,6 @@
(bmh.resources | length > 0) and
(bmh.resources | json_query(query) | length == 0)

- name: Wait for old etcd instance to leave the new etcd-cluster
pause:
minutes: 10

- name: Scale worker up to 1
community.kubernetes.k8s:
api_version: cluster.x-k8s.io/v1alpha3
Expand Down

0 comments on commit f6665bb

Please sign in to comment.