| *** Comments *** |
| # 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. |
| |
| |
| *** Settings *** |
| Documentation [GITOPS-03] Cluster creation in Openstack with CAPI |
| |
| Library OperatingSystem |
| Library String |
| Library Collections |
| Library Process |
| |
| Resource ../lib/advanced_cluster_mgmt_lib.resource |
| |
| Test Tags gitops_03 cluster_gitops |
| |
| Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| |
| |
| *** Variables *** |
| # OKA packages |
| ${OKA_FOLDER} '%{PACKAGES_FOLDER}/oka' |
| ${OKA1_PKG} apps/jenkins |
| ${OKA1_NAME} jenkins |
| ${OKA1_PROFILE} app-profile |
| ${OKA_NS_PKG} apps/namespace |
| ${OKA_NS_NAME} namespace |
| ${OKA_NS_PROFILE} app-profile |
| |
| # Cluster |
| ${CLUSTER_NAME} gitops03 |
| ${CLUSTER_DESCRIPTION} "Cluster for gitops03 Robot test suite" |
| ${CLUSTER_VM_SIZE} m1.large |
| ${CLUSTER_NODES} 1 |
| ${REGION_NAME} northeurope |
| ${RESOURCE_GROUP} OSM-CTIO |
| ${KUBERNETES_VERSION} "1.31.7" |
| ${CLUSTER_CONTROL_PLANE_VM_SIZE} m1.large |
| ${CLUSTER_CONTROL_PLANE_NODES} 1 |
| ${CLUSTER_CONFIG} --config '{"capi-openstack": {"dns-nameservers": "8.8.8.8", "failure-domain": "nova", "external-network-id": "21ea5d92-24f1-40ab-8d28-83230e277a49", "ssh-key-name": "jenkins", "control_plane_node_size": "${CLUSTER_CONTROL_PLANE_VM_SIZE}", "control_plane_node_count": "${CLUSTER_CONTROL_PLANE_NODES}"}}' |
| |
| # KSUs |
| ${KSU_NS_NAME} jenkins-ns |
| ${KSU1_NAME} jenkins |
| ${KSU1_PARAMS} ${CURDIR}/../resources/gitops-jenkins-params.yaml |
| ${KSU_NS_ID} ${EMPTY} |
| ${KSU1_ID} ${EMPTY} |
| |
| |
| *** Test Cases *** |
| Add OKA Packages For The Testsuite |
| [Documentation] Add OKA packages for the testsuite. |
| [Tags] oka create |
| Add OKA Package ${OKA_NS_NAME} '${OKA_FOLDER}/${OKA_NS_PKG}' ${OKA_NS_PROFILE} |
| Add OKA Package ${OKA1_NAME} '${OKA_FOLDER}/${OKA1_PKG}' ${OKA1_PROFILE} |
| |
| Create Cluster For Testsuite in Openstack |
| [Documentation] Create K8s cluster for the testsuite. |
| [Tags] cluster create |
| ${id}= Create Cluster ${CLUSTER_NAME} %{VIM_TARGET} ${CLUSTER_DESCRIPTION} ${CLUSTER_VM_SIZE} ${KUBERNETES_VERSION} ${CLUSTER_NODES} ${REGION_NAME} ${RESOURCE_GROUP} ${CLUSTER_CONFIG} |
| Set Suite Variable ${CLUSTER_ID} ${id} |
| Log ${CLUSTER_ID} |
| |
| Get Cluster Kubeconfig |
| [Documentation] Get Kubeconfig for the cluster. |
| [Tags] cluster |
| ${rc} ${stdout}= Run And Return Rc And Output |
| ... osm cluster-show ${CLUSTER_NAME} -o jsonpath='{.credentials}' | yq -y |
| Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} |
| Log ${stdout} |
| |
| Create KSU Namespace For All KSUs |
| [Documentation] Create KSU based on ${OKA_NS_NAME} with params. |
| [Tags] ksu ksu-ns create |
| ${id}= Create KSU ${KSU_NS_NAME} ${KSU_NS_NAME} ${CLUSTER_NAME} app-profile ${OKA_NS_NAME} ${OKA_FOLDER}/apps/jenkins-ns-params.yaml |
| Set Suite Variable ${KSU_NS_ID} ${id} |
| Log ${KSU_NS_ID} |
| |
| Create KSU1 With Params |
| [Documentation] Create KSU based on ${OKA1_NAME} with params. |
| [Tags] ksu ksu1 create |
| ${id}= Create KSU ${KSU1_NAME} ${KSU1_NAME} ${CLUSTER_NAME} app-profile ${OKA1_NAME} ${KSU1_PARAMS} |
| Set Suite Variable ${KSU1_ID} ${id} |
| Log ${KSU1_ID} |
| |
| Delete KSU1 |
| [Documentation] Delete KSU1 based on ${OKA1_NAME}. |
| [Tags] cleanup ksu ksu1 |
| IF '${KSU1_ID}' != '' |
| ${KSU_TO_BE_DELETED}= Set Variable ${KSU1_ID} |
| ELSE |
| ${KSU_TO_BE_DELETED}= Set Variable ${KSU1_NAME} |
| END |
| Delete KSU ${KSU_TO_BE_DELETED} |
| |
| Delete KSU Namespace |
| [Documentation] Delete KSU based on ${OKA_NS_NAME}. |
| [Tags] cleanup ksu ksu-ns |
| IF '${KSU_NS_ID}' != '' |
| ${KSU_TO_BE_DELETED}= Set Variable ${KSU_NS_ID} |
| ELSE |
| ${KSU_TO_BE_DELETED}= Set Variable ${KSU_NS_NAME} |
| END |
| Delete KSU ${KSU_TO_BE_DELETED} |
| |
| Delete Cluster For Testsuite |
| [Documentation] Delete K8s cluster for the testsuite. |
| [Tags] cleanup cluster |
| Delete Cluster ${CLUSTER_NAME} |
| |
| Delete OKA Packages For The Testsuite |
| [Documentation] Delete OKA packages for the testsuite. |
| [Tags] cleanup oka |
| Delete OKA Package ${OKA_NS_NAME} |
| Delete OKA Package ${OKA1_NAME} |
| |
| |
| *** Keywords *** |
| Suite Cleanup |
| [Documentation] Test Suit Cleanup: Deleting cluster, KSUs, OKAs |
| Run Keyword If Any Tests Failed Delete Cluster ${CLUSTER_NAME} |
| Run Keyword If Any Tests Failed Delete OKA Package ${OKA_NS_NAME} |
| Run Keyword If Any Tests Failed Delete OKA Package ${OKA1_NAME} |