test_k8s_start_manager_workers.yml 4.9 KB

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