Return instance ID of worker node

Return the nova instance UUID of worker nodes in kubeminion
templates. We will be able to remove resources from the
ResourceGroups based on nova instance uuid.

Backstory:
In heat a ResourceGroup creates a stack of depth 2. ResourceGroups
support removal policies to declare which resources must be removed.
This can be done by passing the index of the resource or the stack_id
of the nested stack. If a stack update call receives a list of
indices (eg [0, 5, 3]) or nested stack uuid (eg [uuidA, uuidB]), it
will remove the corresponding nested stacks.

In magnum's heat templates, a nested stack logically represents a
nova compute instance which is a cluster node. Using composition in
heat, we can change the way a resources group references the nested
stacks. This proposes to use the nova instance uuid as
'OS::stack_id'.

With this change, an external consumer of the stack (the cluster
autoscaler or an actual user) can remove resources from the
ResourceGroup using the nova instance uuid or resource index. Without
this change, a user or system  (which typically knows the name,
server uuid or ip) would have to find in which nested stack a
kubernetes node belongs too.  Resulting multiple call to heat.

The end result of this patch can be verified like this:
nested_stack_id=$(openstack stack resource show <STACK_ID_OR_NAME> kube_minions -c physical_resource_id -f value)
openstack stack show "${nested_stack_id}"

Task: 29664
Story: 2005054

Change-Id: I6d776f62d640c72b3228460392b92df94fe56fe6
This commit is contained in:
Feilong Wang 2019-02-25 23:56:59 +13:00 committed by Spyros Trigazis
parent 9323da7819
commit 20d03919fb
4 changed files with 50 additions and 6 deletions

View File

@ -524,7 +524,18 @@ outputs:
description: >
This is the "public" IP address of the Kubernetes minion node.
######################################################################
#
# NOTE(flwang): Returning the minion node server ID here so that
# consumer can send API request to Heat to remove a particular
# node with removal_policies. Otherwise, the consumer (e.g. AutoScaler)
# has to use index to do the remove which is confusing out of the
# OpenStack world.
# https://storyboard.openstack.org/#!/story/2005054
#
######################################################################
OS::stack_id:
value: {get_param: "OS::stack_id"}
value: { get_resource: kube-minion }
description: >
This is a id of the stack which creates from this template.
This is the Nova server id of the node.

View File

@ -543,7 +543,18 @@ outputs:
description: >
This is the "public" IP address of the Kubernetes minion node.
######################################################################
#
# NOTE(flwang): Returning the minion node server ID here so that
# consumer can send API request to Heat to remove a particular
# node with removal_policies. Otherwise, the consumer (e.g. AutoScaler)
# has to use index to do the remove which is confusing out of the
# OpenStack world.
# https://storyboard.openstack.org/#!/story/2005054
#
######################################################################
OS::stack_id:
value: {get_param: "OS::stack_id"}
value: { get_resource: kube-minion }
description: >
This is a id of the stack which creates from this template.
This is the Nova server id of the node.

View File

@ -108,7 +108,18 @@ outputs:
description: >
This is the "public" IP address of the Kubernetes minion node.
######################################################################
#
# NOTE(flwang): Returning the minion node server ID here so that
# consumer can send API request to Heat to remove a particular
# node with removal_policies. Otherwise, the consumer (e.g. AutoScaler)
# has to use index to do the remove which is confusing out of the
# OpenStack world.
# https://storyboard.openstack.org/#!/story/2005054
#
######################################################################
OS::stack_id:
value: {get_param: "OS::stack_id"}
value: { get_resource: kube-minion }
description: >
This is a id of the stack which creates from this template.
This is the Ironic server id of the node.

View File

@ -0,0 +1,11 @@
---
fixes:
- |
Return instance ID of workder node in k8s minion template so that
consumer can send API request to Heat to remove a particular
node with removal_policies. Otherwise, the consumer (e.g. AutoScaler)
has to use index to do the remove which is confusing out of the
OpenStack world.
https://storyboard.openstack.org/#!/story/2005054