-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove cluster from kubeconfig when deleting #226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @kschumy, thanks!! My only comment would be, do you think it would be possible to get some tests around the deletion from the kubeconfig file?
I was never happy with the fact that i didn't add full deletion when i changed the code around the kubeconfig file. So this is great!
I'm glad you like it! I'll work on tests and get back to you. Thanks! |
Great, thanks @kschumy. The tests for the kubeconfig package use standard Go tests but for other packages we have started to use Gingko (for example, the Let me know if i can help. |
cf07797
to
3a06bde
Compare
Sorry! I didn't see your comment until now. I created a test but did not use Ginkgo, but I'll do that in the future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests around the new deletion code!
Ideally it would be good to have the 2 yaml files in a testdata
subfolder. However, we could do this in the future when we refactor the tests to use Ginkgo and golden files (i just created
#230 for this).
3a06bde
to
10a78c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of small changes now the test files have been moved.
Would you also be able to rebase on master? This will be good to go then, thanks again, great work.
// All the information for cluster-one.us-west-2.eksctl.io is identical to one-cluster.yaml. If all | ||
// the information for cluster-two.us-west-2.eksctl.io is deleted, the file should be identical to | ||
// one-cluster.yaml and oneClusterAsBytes. | ||
var twoClustersAsBytes, _ = ioutil.ReadFile("./two-clusters.yaml") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
// Cluster name is 'cluster-one.us-west-2.eksctl.io'. | ||
// All the information is identical to cluster cluster-one.us-west-2.eksctl.io in two-clusters.yaml. | ||
var oneClusterAsBytes, _ = ioutil.ReadFile("./one-cluster.yaml") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
If the kubeconfig contains an eksctl-created cluster, deleting the cluster will now remove the cluster from the kubeconfig.
Checks to see if MaybeDeleteConfig removes a cluster from the kubeconfig when deleting the cluster if the kubeconfig has the cluster's information and does not change the kubeconfig if it does not. Also adds functions to supportthe test, such as managing the KUBECONFIG env variable, getting a clusterconfig example, and converting example kubeconfig yaml files into bytes.
dbca355
to
dc17611
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Thanks for changing and rebasing. Feel free to merge when you get time.
@kschumy awesome, thanks a lot for this PR! 👍 |
…e-e2e New block volume e2e tests
Description
If the kubeconfig contains an eksctl-created cluster, deleting the cluster will now remove the cluster from the kubeconfig.
Checklist
make build
)make test
)humans.txt
file