Add WC for HCO env
- added wait handle to HCO env
- added metadata for Ceph nodes
Related-PROD: KUBV-73
Change-Id: Ib8feca2eb1243586e5b17c869eed23f3a1ab5ccd
diff --git a/hco/fragments/VMInstance.yaml b/hco/fragments/VMInstance.yaml
index b4115f3..15dad90 100644
--- a/hco/fragments/VMInstance.yaml
+++ b/hco/fragments/VMInstance.yaml
@@ -2,8 +2,6 @@
parameters:
- node_type:
- type: string
k8s_network:
type: string
k8s_subnet_id:
@@ -12,9 +10,15 @@
type: string
data_network:
type: string
+ storage_frontend_network:
+ type: string
availability_zone:
type: string
default: nova
+ boot_timeout:
+ type: number
+ description: Boot timeout for instance
+ default: 600
image:
type: string
description: Name of image to use for servers
@@ -41,6 +45,15 @@
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 }
+
vm_server:
type: OS::Nova::Server
properties:
@@ -50,7 +63,36 @@
key_name: { get_param: key_name }
networks:
- port: { get_resource: k8s_network_port }
+ - network: { get_param : storage_frontend_network }
- network: { get_param : data_network }
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+
+ set -x
+
+ STATUS="SUCCESS"
+ REASON="The node has been successfully deployed"
+ DATA_BINARY="{\"status\": \"$STATUS\", \"reason\": \"$REASON\"}"
+ echo "Sending notification to wait condition ..."
+
+ WC_EXIT_CODE=1
+ counter=0
+ while (( ${WC_EXIT_CODE} != 0 && ${counter} < 3 )); do
+ wc_notify -k --data-binary "$DATA_BINARY" && WC_EXIT_CODE=0
+ counter=$((counter + 1))
+ sleep 5
+ done
+
+ if (( ${WC_EXIT_CODE} !=0 ))
+ then
+ echo "Cannot send notification to wait condition with a SUCCESS status"
+ exit 1
+ fi
+ params:
+ wc_notify: { get_attr: [wait_handle, curl_cli] }
outputs:
server_public_ip: