From 9cb52f0f0b3d3f162606d48a51ba86b9459a1a06 Mon Sep 17 00:00:00 2001 From: Cloud User Date: Sun, 2 Jul 2023 10:37:32 +0000 Subject: [PATCH 1/3] worker node creation added --- playbooks/scenario18a_cluster.yaml | 50 ++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/playbooks/scenario18a_cluster.yaml b/playbooks/scenario18a_cluster.yaml index 72fa89c..d93234f 100644 --- a/playbooks/scenario18a_cluster.yaml +++ b/playbooks/scenario18a_cluster.yaml @@ -3,6 +3,13 @@ hosts: localhost vars: prefix: scenario18a- + test_cce_flavor: cce.s1.small + test_cce_container_network_mode: overlay_l2 + test_node_flavor: s3.large.2 + test_node_os: 'EulerOS 2.9' + test_volume_type: SAS + test_volume_size: 100 + tasks: - set_fact: prefix: "{{ (prefix + ( lookup('env', 'TASK_EXECUTOR_JOB_ID') | default(99999999 | random | to_uuid | hash('md5'), true) ) ) }}" @@ -13,8 +20,8 @@ test_network_name: "{{ (prefix + '-test_network_apimon') }}" # NOTE: CCE doesn't support "_" test_cluster_name: "{{ ('z-' + prefix + '-cluster') }}" - test_cce_flavor: "cce.s1.small" - test_cce_container_network_mode: "overlay_l2" + test_keypair_name: "{{ ( prefix + '-cce-kp' ) }}" + test_node_name: "{{ ( prefix + '-node' ) }}" - block: @@ -27,6 +34,17 @@ subnet_name: "{{ test_subnet_name }}" state: present + - name: Create Keypair + include_role: + name: opentelekomcloud.keypair + vars: + keypair_name: "{{ test_keypair_name }}" + state: "present" + + - name: Get Availability zones + opentelekomcloud.cloud.availability_zone_info: + register: azs + - name: Create CCE Cluster opentelekomcloud.cloud.cce_cluster: state: present @@ -41,6 +59,27 @@ - 'service=cce' - 'metric=create_cce_cluster' + - name: Create Worker Node + opentelekomcloud.cloud.cce_cluster_node: + availability_zone: "{{ az }}" + cluster: "{{ test_cluster_name }}" + count: 1 + data_volumes: + - volumetype: "{{ test_volume_type }}" + size: "{{ test_volume_size }}" + flavor: "{{ test_node_flavor }}" + ssh_key: "{{ test_keypair_name }}" + name: "{{ test_node_name }}" + network: "{{ test_network_name }}" + os: "{{ test_node_os }}" + root_volume_size: "{{ test_volume_size }}" + root_volume_type: "{{ test_volume_type }}" + wait: true + timeout: 300 + state: present + vars: + az: "{{ azs['availability_zones'][0]['name'] }}" + - name: Delete CCE Cluster opentelekomcloud.cloud.cce_cluster: name: "{{ test_cluster_name }}" @@ -51,6 +90,13 @@ always: - block: + - name: Create Keypair + include_role: + name: opentelekomcloud.keypair + vars: + keypair_name: "{{ test_keypair_name }}" + state: "absent" + - name: Delete VPC include_role: name: opentelekomcloud.vpc From ed4e30fd978249c4f0a18b31f57b312d746c4bee Mon Sep 17 00:00:00 2001 From: oeotvos <56148026+oeotvos@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:13:06 +0100 Subject: [PATCH 2/3] Update scenario18a_cluster.yaml --- playbooks/scenario18a_cluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/scenario18a_cluster.yaml b/playbooks/scenario18a_cluster.yaml index d93234f..20b1466 100644 --- a/playbooks/scenario18a_cluster.yaml +++ b/playbooks/scenario18a_cluster.yaml @@ -90,7 +90,7 @@ always: - block: - - name: Create Keypair + - name: Delete Keypair include_role: name: opentelekomcloud.keypair vars: From 332a5963b807c2f05bfd7d7a1b38a3ef07faf8d3 Mon Sep 17 00:00:00 2001 From: Cloud User Date: Thu, 15 Feb 2024 17:13:32 +0000 Subject: [PATCH 3/3] nodepool and query added --- playbooks/scenario18a_cluster.yaml | 50 ++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/playbooks/scenario18a_cluster.yaml b/playbooks/scenario18a_cluster.yaml index 20b1466..132b2d7 100644 --- a/playbooks/scenario18a_cluster.yaml +++ b/playbooks/scenario18a_cluster.yaml @@ -1,5 +1,5 @@ --- -- name: Scenario 18 - empty CCE cluster functionality +- name: Scenario 18 - CCE cluster with worker nodes hosts: localhost vars: prefix: scenario18a- @@ -7,7 +7,7 @@ test_cce_container_network_mode: overlay_l2 test_node_flavor: s3.large.2 test_node_os: 'EulerOS 2.9' - test_volume_type: SAS + test_volume_type: SSD test_volume_size: 100 tasks: @@ -18,10 +18,10 @@ test_router_name: "{{ (prefix + '-test_router_apimon') }}" test_subnet_name: "{{ (prefix + '-test_subnet_apimon') }}" test_network_name: "{{ (prefix + '-test_network_apimon') }}" - # NOTE: CCE doesn't support "_" test_cluster_name: "{{ ('z-' + prefix + '-cluster') }}" test_keypair_name: "{{ ( prefix + '-cce-kp' ) }}" test_node_name: "{{ ( prefix + '-node' ) }}" + test_node_pool_name: "{{ ( prefix + '-pool' ) }}" - block: @@ -54,11 +54,34 @@ router: "{{ test_router_name }}" network: "{{ test_network_name }}" container_network_mode: "{{ test_cce_container_network_mode }}" + wait: true register: cluster tags: - 'service=cce' - 'metric=create_cce_cluster' + - name: Create NodePool Node + opentelekomcloud.cloud.cce_node_pool: + availability_zone: "{{ az }}" + cluster: "{{ test_cluster_name }}" + initial_node_count: 1 + data_volumes: + - volumetype: "{{ test_volume_type }}" + size: "{{ test_volume_size }}" + flavor: "{{ test_node_flavor }}" + ssh_key: "{{ test_keypair_name }}" + name: "{{ test_node_pool_name }}" + network: "{{ test_network_name }}" + os: "{{ test_node_os }}" + root_volume_size: "{{ test_volume_size }}" + root_volume_type: "{{ test_volume_type }}" + wait: false + timeout: 300 + state: present + register: pool + vars: + az: "{{ azs['availability_zones'][1]['name'] }}" + - name: Create Worker Node opentelekomcloud.cloud.cce_cluster_node: availability_zone: "{{ az }}" @@ -80,10 +103,31 @@ vars: az: "{{ azs['availability_zones'][0]['name'] }}" + - name: Query CCE Cluster + opentelekomcloud.cloud.cce_cluster_info: + name: "{{ test_cluster_name }}" + register: cluster_info + + - name: Query NodePool Node + opentelekomcloud.cloud.cce_node_pool_info: + cce_cluster: "{{ test_cluster_name }}" + register: pool + # purpose of wait:false for nodepool is to have simoultaneous creation of 2 nodes + until: pool.cce_node_pools[0].status.status == "" + retries: 30 + delay: 5 + + - name: Query Worker Node + opentelekomcloud.cloud.cce_cluster_node_info: + cce_cluster: "{{ test_cluster_name }}" + name: "{{ test_node_name }}" + register: node + - name: Delete CCE Cluster opentelekomcloud.cloud.cce_cluster: name: "{{ test_cluster_name }}" state: "absent" + wait: true tags: - 'service_cce' - 'metric=delete_cce_cluster'