[KUBEV] Deploy a dedicated node for test usage (tsrv).
Related: KUBEV-521
Change-Id: Ide3fe1c4560440b23df38ceb2e76a77da0b8fd0d
diff --git a/hco/fragments/VMCompute.yaml b/hco/fragments/VMCompute.yaml
index e7f44c8..a3b41c0 100644
--- a/hco/fragments/VMCompute.yaml
+++ b/hco/fragments/VMCompute.yaml
@@ -28,12 +28,6 @@
key_name:
type: string
description: Name of keypair to assign to servers
- k8s_vip:
- type: string
- description: VIP of kubernetes (child cluster)
- k8s_svc_network_cidr:
- type: string
- description: CIDR of kubernetes service network
resources:
@@ -99,7 +93,6 @@
- virtinst
- python3-virtualbmc
- ipmitool
- - docker.io
write_files:
- path: /etc/systemd/system/virtualbmc.service
content: |
@@ -124,14 +117,9 @@
br_pxe:
interfaces: [ens4]
addresses: [ip_addr/ip_mask]
- routes:
- - to: k8s_svc_network_cidr
- via: k8s_vip
params:
ip_addr: { get_attr: [ ip_addr_pxe, value ] }
ip_mask: { get_attr: [ ip_mask_pxe, value ] }
- k8s_vip: { get_param: k8s_vip }
- k8s_svc_network_cidr: { get_param: k8s_svc_network_cidr }
runcmd:
- str_replace:
template: |
diff --git a/hco/fragments/VMInstance.yaml b/hco/fragments/VMInstance.yaml
index 53e0660..40be33b 100644
--- a/hco/fragments/VMInstance.yaml
+++ b/hco/fragments/VMInstance.yaml
@@ -101,3 +101,6 @@
server_public_ip:
description: Floating IP address of server in public network
value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }
+ server_k8s_ipv4:
+ description: List of assigned network addresses
+ value: { get_attr: [ k8s_network_port, fixed_ips, 0, ip_address ] }
diff --git a/hco/fragments/VMInstanceCeph.yaml b/hco/fragments/VMInstanceCeph.yaml
index 61cbd9e..48d1860 100644
--- a/hco/fragments/VMInstanceCeph.yaml
+++ b/hco/fragments/VMInstanceCeph.yaml
@@ -211,3 +211,6 @@
wc_data:
description: Metadata from instance
value: { get_attr: [wait_condition, data]}
+ server_k8s_ipv4:
+ description: List of assigned network addresses
+ value: { get_attr: [ k8s_network_port, fixed_ips, 0, ip_address ] }
diff --git a/hco/fragments/VMTestSrv.yaml b/hco/fragments/VMTestSrv.yaml
new file mode 100644
index 0000000..a056231
--- /dev/null
+++ b/hco/fragments/VMTestSrv.yaml
@@ -0,0 +1,112 @@
+heat_template_version: queens
+
+parameters:
+
+ k8s_network:
+ type: string
+ k8s_subnet_id:
+ type: string
+ public_net_id:
+ type: string
+ availability_zone:
+ type: string
+ default: nova
+ boot_timeout:
+ type: number
+ description: Boot timeout for instance
+ default: 450
+ image:
+ type: string
+ description: Name of image to use for servers
+ flavor:
+ type: string
+ description: Flavor to use for servers
+ key_name:
+ type: string
+ description: Name of keypair to assign to servers
+ k8s_vip:
+ type: string
+ description: VIP of kubernetes (child cluster)
+ k8s_svc_network_cidr:
+ type: string
+ description: CIDR of kubernetes service network
+
+resources:
+
+ k8s_network_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: k8s_network }
+ port_security_enabled: false
+ fixed_ips:
+ - subnet: { get_param: k8s_subnet_id }
+
+ floating_ip_k8s_net:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: public_net_id }
+ port_id: { get_resource: k8s_network_port }
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: { get_resource: wait_handle }
+ timeout: { get_param: boot_timeout }
+
+ server_init:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ password: 'r00tme'
+ chpasswd:
+ expire: false
+ ssh_pwauth: true
+ packages:
+ - python3
+ - docker.io
+ write_files:
+ - path: /etc/netplan/98-custom.yaml
+ permissions: '0600'
+ content:
+ str_replace:
+ template: |
+ network:
+ version: 2
+ ethernets:
+ ens3:
+ routes:
+ - to: k8s_svc_network_cidr
+ via: k8s_vip
+ params:
+ k8s_vip: { get_param: k8s_vip }
+ k8s_svc_network_cidr: { get_param: k8s_svc_network_cidr }
+ runcmd:
+ - str_replace:
+ template: |
+ #!/bin/bash
+ set +x
+ netplan apply
+ # Simple success signal
+ wc_notify --data-binary '{"status": "SUCCESS"}'
+ params:
+ wc_notify: { get_attr: [ wait_handle, curl_cli ] }
+
+ server:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone }
+ image: { get_param: image }
+ flavor: { get_param: flavor }
+ key_name: { get_param: key_name }
+ networks:
+ - port: { get_resource: k8s_network_port }
+ user_data_format: RAW
+ user_data: { get_resource: server_init }
+
+outputs:
+ server_public_ip:
+ description: Floating IP address of server in public network
+ value: { get_attr: [ floating_ip_k8s_net, floating_ip_address ] }