forked from dell/omnia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_k8s_start_manager_workers.yml
144 lines (128 loc) · 4.9 KB
/
test_k8s_start_manager_workers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# OMNIA_UKP_US_VFKP_TC_009, OMNIA_UKP_US_VFKP_TC_010
# Execute k8s_start_manager role in manager nodes with os installed centos 7.9 and swap enabled
- name: OMNIA_UKP_US_VFKP_TC_009, OMNIA_UKP_US_VFKP_TC_010
hosts: manager
gather_facts: false
vars_files:
- test_vars/test_k8s_start_manager_workers_vars.yml
tasks:
- name: Enable Swap
command: /usr/sbin/swapon -a
changed_when: true
tags: TC_009, TC_010
- block:
- name: Call k8s_start_manager role
include_role:
name: ../roles/k8s_start_manager
tags: TC_009, TC_010
- name: Waiting for the pods deployment
pause:
minutes: 10
tags: TC_009, TC_010
- name: Checking master node
command: kubectl get nodes
register: master_node_status
changed_when: false
ignore_errors: True
tags: TC_009, TC_010, VERIFY_009
- name: Checking kube-system pods
command: kubectl get pods --namespace kube-system --field-selector=status.phase=Running
register: kube_system_pods
changed_when: false
ignore_errors: True
tags: TC_009, TC_010, VERIFY_009
- name: Checking calico/flannel SDN network status
command: ip address
register: calico_flannel_status
changed_when: false
tags: TC_009, TC_010, VERIFY_009
- name: Checking K8s service account and token
command: kubectl get secrets
register: service_account_status
changed_when: false
ignore_errors: True
tags: TC_009, TC_010, VERIFY_009
- name: Validating master node status
assert:
that:
- "'master' in master_node_status.stdout"
fail_msg: "{{ master_node_status_fail_msg }}"
success_msg: "{{ master_node_status_success_msg }}"
tags: TC_009, TC_010, VERIFY_009
- name: Validating controller-manager and scheduler and coreDNS pods status
assert:
that:
- "'kube-scheduler' in kube_system_pods.stdout"
- "'kube-controller' in kube_system_pods.stdout"
fail_msg: "{{ controller_scheduler_status_fail_msg }}"
success_msg: "{{ controller_scheduler_status_success_msg }}"
tags: TC_009, TC_010, VERIFY_009
- name: Validating coreDNS pods status
assert:
that:
- "'coredns' in kube_system_pods.stdout"
fail_msg: "{{ coredns_status_fail_msg }}"
success_msg: "{{ coredns_status_success_msg }}"
tags: TC_009, TC_010, VERIFY_009
- name: Validating calico/flannel SDN network status
assert:
that:
- "'calico' in kube_system_pods.stdout or 'flannel' in kube_system_pods.stdout"
fail_msg: "{{ calico_flannel_status_fail_msg }}"
success_msg: "{{ calico_flannel_status_success_msg }}"
tags: TC_009, TC_010, VERIFY_009
- name: Validating K8s service account and token status
assert:
that:
- "'kubernetes.io/service-account-token' in service_account_status.stdout"
fail_msg: "{{ k8s_service_account_status_fail_msg }}"
success_msg: "{{ k8s_service_account_status_success_msg }}"
tags: TC_009, TC_010, VERIFY_009
# OMNIA_UKP_US_VFKP_TC_011, OMNIA_UKP_US_VFKP_TC_012
# Execute k8s_start_workers role in compute nodes with os installed centos 7.9 and swap enabled
- name: OMNIA_UKP_US_VFKP_TC_011, OMNIA_UKP_US_VFKP_TC_012
hosts: compute
gather_facts: false
tasks:
- name: Enable Swap
command: /usr/sbin/swapon -a
changed_when: true
tags: TC_011, TC_012
- block:
- name: Call k8s_start_workers role
include_role:
name: ../roles/k8s_start_workers.yml
tags: TC_011, TC_012
- name: OMNIA_UKP_US_VFKP_TC_011, OMNIA_UKP_US_VFKP_TC_012
hosts: manager
gather_facts: false
vars_files:
- test_vars/test_k8s_start_manager_workers_vars.yml
tasks:
- name: Check worker nodes status
command: kubectl get node --selector='!node-role.kubernetes.io/master'
register: worker_nodes_status
changed_when: false
ignore_errors: True
tags: TC_011, TC_012, VERIFY_011
- name: Validating worker nodes status
assert:
that:
- "'Ready' in worker_nodes_status.stdout"
fail_msg: "{{ worker_nodes_status_fail_msg }}"
success_msg: "{{ worker_nodes_status_success_msg }}"
tags: TC_011, TC_012, VERIFY_011