Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Removing non-existing cluster via configuration #886

Merged
merged 1 commit into from
Dec 12, 2021
Merged

[Fix] Removing non-existing cluster via configuration #886

merged 1 commit into from
Dec 12, 2021

Conversation

kuritka
Copy link
Contributor

@kuritka kuritka commented Dec 10, 2021

What

With k3d I can delete a cluster before it is created. Such a use case is very useful in case I want to restart my test environment.

reset:
     k3d cluster delete mycluster
     k3d cluster create mycluster
     <installing things....>

Even better is to use a configuration with the argument -c config.yaml. The k3d can delete a
cluster based on configuration, but it cannot handle the case that the cluster does not exist.

INFO[0000] Using config file ./local.yaml (k3d.io/v1alpha3#simple) 
FATA[0000] failed to delete cluster 'mycluster': No nodes found for given cluster 

This PR allows that if I use the configuration and delete a non-existing cluster, k3d will not end up fatal.

# k3d cluster delete -c ./local.yaml
INFO[0000] Using config file ./local.yaml (k3d.io/v1alpha3#simple) 
INFO[0000] No nodes found for cluster 'mucluster', nothing to delete. 
INFO[0000] No clusters found                            

Why

It is important for me that the cluster name is used in one single place - ideally the configuration.
Thanks to this PR I can do the following:

reset:
	k3d cluster delete -c cluster/local.yaml
	k3d cluster create -c cluster/local.yaml

Implications

The change concerns one scenario - deleting a non-existing cluster if the cluster name is in the configuration.

Signed-off-by: kuritka [email protected]

@kuritka kuritka changed the title [Feature] Removing non-existing cluster via configuration [Fix] Removing non-existing cluster via configuration Dec 10, 2021
cmd/cluster/clusterDelete.go Outdated Show resolved Hide resolved
@iwilltry42 iwilltry42 added this to the v5.2.2 milestone Dec 11, 2021
@iwilltry42 iwilltry42 added the enhancement New feature or request label Dec 11, 2021
@iwilltry42
Copy link
Member

Hi @kuritka , thanks for your contribution!
I just have a slightly different take on this 👍

@iwilltry42 iwilltry42 self-assigned this Dec 11, 2021
@iwilltry42 iwilltry42 merged commit 4ffc71d into k3d-io:main Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants