kismatic icon indicating copy to clipboard operation
kismatic copied to clipboard

Add ability to destroy a single node

Open based64god opened this issue 6 years ago • 7 comments

Currently the provisioner can only mutate to destroy nodes indiscriminately, it would be ideal if the user could specify what nodes they want to destroy during a mutation.

based64god avatar Jan 18 '18 16:01 based64god

After some extensive testing, this doesn't seem to be possible with current implementations of Terraform. Resources cannot be targeted by their index, matching my observed output with a discussion on the Terraform Gitter. IE a terraform destroy -target=aws_instance.worker.2 does not work, and won't remove worker 2, but a terraform destroy -target=aws_instance.worker does - though it obviously does not yield the desired behavior. Tagging this as needing an upstream fix for now, and leaving the issue open.

based64god avatar Jan 19 '18 14:01 based64god

@emmetthitz were there any workarounds or is there just no way to remove a specific resource?

dkoshkin avatar Jan 19 '18 15:01 dkoshkin

The easiest way would be for the user to set the number of nodes in the plan file from N to N-1 As long as everything is in an ASG (or equivalent) terraform can do the rest.

swade1987 avatar Jan 19 '18 15:01 swade1987

@swade1987 The motivation here is that a user might want to drain a node, delete it from the cluster and then choose a specific node to delete.

dkoshkin avatar Jan 19 '18 15:01 dkoshkin

@dkoshkin sure but then you are treating your servers as pets rather than cattle.

swade1987 avatar Jan 19 '18 15:01 swade1987

@swade1987 in the case where you want to scale down, it would be nice to be able to delete a specific node. I think that's what @dkoshkin meant.

based64god avatar Jan 19 '18 16:01 based64god

@emmetthitz this isn't how cloud providers work through.

They either scale up or down based on underlying cloud monitoring which usually monitors CPU or RAM usage on nodes and basis decisions off these.

swade1987 avatar Jan 19 '18 16:01 swade1987