-
Notifications
You must be signed in to change notification settings - Fork 3
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
WIP: Add cluster control to makefile #943
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #943 +/- ##
==========================================
- Coverage 50.40% 50.36% -0.04%
==========================================
Files 102 102
Lines 5619 5619
==========================================
- Hits 2832 2830 -2
- Misses 2548 2549 +1
- Partials 239 240 +1 ☔ View full report in Codecov by Sentry. |
8a236e1
to
baf80ab
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 seems like it could be useful! Perhaps the user experience could be improved by introducing the notion of idempotency? For example:
cluster
- Ensures that the cluster is created and running. This is the first thing you would do when bringing up the environment for the first time or after being already created. If you run it twice, the second time should be a no-op.cluster-destroy
- Ensures that the cluster is destroyed (without failing if it doesn't exist).cluster-stop
- Ensures that the cluster is stopped (without failing if it's already stopped or doesn't exist).
On top of that:
cluster-rebuild: cluster-destroy cluster-ensure # @HELP Rebuild the cluster.
@echo "Rebuilding the cluster complete."
Not sure if that's a lot to ask or whether it'd be more sensible to implement it in hack/cluster.sh
as a bash script and have these targets become simple wrappers.
In any case, this is probably a good start, we can improve it later.
read | ||
kubectl delete pvc,pv --all | ||
k3d cluster delete sdps-local | ||
docker system prune --all |
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.
docker system prune --all
What do we gain from this in this context? It looks like this is something that could impact other dev environments on my machine.
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.
Hi @mcantelon!
I'm not sure this adds a lot of value, my cluster and registry are called differently, I could easily change that to match this and the docs, but see my comments below for other reasons. I'm also happy to add it it if you think it's useful, but working with k3d
and kubectl
from the terminal is going to happen eventually.
|
||
cluster-stop: # @HELP Stop cluster. | ||
k3d cluster stop sdps-local | ||
tilt down |
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.
tilt down
is not going to work with the cluster stopped. I also like to keep the cluster as it was between restarts, so I rarely run tilt down
in general.
|
||
cluster-rebuild: # @HELP Rebuild cluster. | ||
k3d cluster stop sdps-local | ||
tilt down |
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.
Same here, it's also not needed if you are going to delete the cluster after.
echo | ||
echo "Press [enter] to continue..." | ||
read | ||
kubectl delete pvc,pv --all |
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.
No need to to this if you are going to delete the entire cluster.
kubectl delete pvc,pv --all | ||
k3d cluster delete sdps-local | ||
docker system prune --all | ||
k3d cluster create sdps-local --registry-create sdps-registry |
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.
I like to use the same registry for all the clusters as many projects share the same images/layers, you could use --registry-use
instead. Because it's a rebuild it should exist, but we are missing cluster-create
and cluster-delete
target rules to make sure the names match. It can get tricky if you think in all the possible states of the cluster and registry.
Just an idea... I roughed this up, based on the docs and internal recommendations, in case folks think it'd be useful to add.
Adding a RAM recommendation to it (I don't see one in the docs) could be good too so devs/potential devs don't end up running it with too little RAM (I've got 32GB and it seems to be working fine).