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

WIP: Add cluster control to makefile #943

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

mcantelon
Copy link
Contributor

@mcantelon mcantelon commented May 17, 2024

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).

Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.36%. Comparing base (eab4154) to head (baf80ab).

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.
📢 Have feedback on the report? Share it here.

@mcantelon mcantelon force-pushed the dev/cluster-control branch from 8a236e1 to baf80ab Compare May 17, 2024 22:05
Copy link
Contributor

@sevein sevein left a 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
Copy link
Contributor

@sevein sevein May 18, 2024

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.

Copy link
Collaborator

@jraddaoui jraddaoui left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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.

@mcantelon mcantelon changed the title Add cluster control to makefile WIP: Add cluster control to makefile May 31, 2024
@mcantelon mcantelon marked this pull request as draft May 31, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants