Browse Source

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
changes/53/639053/6
Feilong Wang 2 years ago
committed by Spyros Trigazis
parent
commit
20d03919fb
  1. 15
      magnum/drivers/k8s_coreos_v1/templates/kubeminion.yaml
  2. 15
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml
  3. 15
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion.yaml
  4. 11
      releasenotes/notes/return-server-id-in-kubeminion-cb33f5141e0b7fa9.yaml

15
magnum/drivers/k8s_coreos_v1/templates/kubeminion.yaml

@ -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.

15
magnum/drivers/k8s_fedora_atomic_v1/templates/kubeminion.yaml

@ -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.

15
magnum/drivers/k8s_fedora_ironic_v1/templates/kubeminion.yaml

@ -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.

11
releasenotes/notes/return-server-id-in-kubeminion-cb33f5141e0b7fa9.yaml

@ -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
Loading…
Cancel
Save