Skip to content

Instantly share code, notes, and snippets.

@openstacker
Created February 26, 2019 21:30
Show Gist options
  • Save openstacker/2104ef54e8e4a75a23df391c5e266fb3 to your computer and use it in GitHub Desktop.
Save openstacker/2104ef54e8e4a75a23df391c5e266fb3 to your computer and use it in GitHub Desktop.
Heat delete resource
(10:09:09) flwang: schaney: are you talking about this https://review.openstack.org/639053 ?
(10:09:37) strigazi: schaney: flwang bare with me for the explanation, also this change needs more comments in the commit message ^^
(10:10:02) strigazi: in heat a resource group creates a stack with depth two
(10:10:33) strigazi: the first nested stack kube_minions has a ref_map output
(10:10:39) strigazi: which goes like this:
(10:10:45) strigazi: 0: <smth>
(10:10:51) strigazi: 1: <smth>
(10:10:52) strigazi: and so on
(10:11:29) strigazi: These indices are the minion-INDEX numbers
(10:11:48) strigazi: and the indices in the ResourceGroup
(10:12:10) strigazi: A RG supports removal_poliies
(10:12:12) strigazi: A RG supports removal_policies
(10:12:49) strigazi: which means you can pass a list of indices as a param, and heat will remove these resources from the RG
(10:13:12) brtknr: I am not clear on what is using the change made in https://review.openstack.org/639053 atm
(10:13:26) strigazi: additionally, heat will track which indices have removed and won't create them again
(10:13:31) strigazi: brtknr: bare with me
(10:13:40) strigazi: so,
(10:14:00) strigazi: in the first imlementation of removal policies in the k8s templates
(10:14:27) strigazi: the IP was used as an id in this list:
(10:14:36) strigazi: 0: private-ip-1
(10:14:42) strigazi: 1: private-ip-2
(10:14:55) strigazi: (or zero based :))
(10:15:26) strigazi: then it was changes with this commit:
(10:15:54) strigazi: https://github.com/openstack/magnum/commit/3ca2eb30369a00240a92c254c95bea6c7a60fee1
(10:16:07) strigazi: and the ref_map became like this:
(10:16:26) strigazi: 0: stack_id_of_nested_stack_0_depth_2
(10:16:32) strigazi: 1: stack_id_of_nested_stack_1_depth_2
(10:16:59) strigazi: and the above patch broke the removal policy of the resouce group
(10:17:23) strigazi: meaning, if you passed a list of ips to the removal policy after the above patch
(10:17:50) strigazi: heat wouldn't understand to whoch index in the RG that ip belonged too
(10:18:01) strigazi: that is why for flwang and schaney didn't work
(10:18:14) schaney: gotcha
(10:18:30) strigazi: flwang: now proposes a change
(10:18:37) strigazi: to make the ref_map:
(10:18:51) strigazi: 0: nova_server_uuid_0
(10:18:55) strigazi: 1: nova_server_uuid_1
(10:19:11) strigazi: you can inspect this map in current cluster like this:
(10:19:24) imdigitaljim [[email protected]] entered the room.
(10:19:43) colin-: sorry i'm late
(10:19:48) strigazi: openstack stack list --nested | grep <parent_stack_name> | grep kube_minions
(10:20:03) strigazi: and then show the nested stack of depth 1
(10:20:07) strigazi: you will see the list
(10:20:14) strigazi: you will see the ref_map
(10:20:15) strigazi: eg:
(10:21:41) brtknr: `openstack stack list --nested` is a nice trick!
(10:21:43) brtknr: til
(10:22:04) strigazi: http://paste.openstack.org/show/746304/
(10:22:22) strigazi: this is with the IP ^^
(10:22:23) brtknr: ive always done `openstack stack resource list k8s-stack --nested-depth=4
(10:23:17) eandersson_: o/
(10:23:23) strigazi: http://paste.openstack.org/show/746305/
(10:23:40) strigazi: this is with the stack_id
(10:23:49) imdigitaljim: \o
(10:23:51) strigazi: check uuid b4e8a1ec-0b76-48cb-b486-2a5459ea45d4
(10:24:01) strigazi: in the ref_map and in the list of stacks
(10:24:24) imdigitaljim: i like the new change to uuid =)
(10:24:54) flwang: imdigitaljim: yep, uuid is more reliable than ip for some cases
(10:24:55) strigazi: after said change, we will see the nova uuid there
(10:25:24) strigazi: so, in heat we can pass either the server uuid or the index
(10:25:36) strigazi: then heat will store the removed ids here:
(10:26:24) strigazi: http://paste.openstack.org/show/746306/
(10:26:33) strigazi: makes sense?
(10:27:36) jakeyip: sounds good to me
(10:27:52) schaney: yep! the confusion on my end was the "output" relationship to removal policy member
(10:28:30) schaney: and the nested stack vs the resource representing the stack
(10:28:37) schaney: makes sense now though
(10:29:03) strigazi: I spent a full moring with thomas on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment