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

🌱 Add make targets for setting up Tilt #7097

Merged
merged 1 commit into from
Sep 2, 2022

Conversation

Jont828
Copy link
Contributor

@Jont828 Jont828 commented Aug 19, 2022

What this PR does / why we need it: Add make targets to create a kind cluster and set up Tilt with make tilt-up and delete kind cluster with kind-reset

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 19, 2022
@k8s-ci-robot
Copy link
Contributor

@Jont828: This issue is currently awaiting triage.

If CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 19, 2022
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 19, 2022
@Jont828 Jont828 marked this pull request as ready for review August 19, 2022 23:21
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 19, 2022
Makefile Outdated

.PHONY: tilt-up
tilt-up: kind-cluster ## Start tilt and build kind cluster if needed.
EXP_CLUSTER_RESOURCE_SET=true EXP_MACHINE_POOL=true tilt up
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are setting these env values here. A user can set the feature gates in tilt-settings.yaml, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also prefer having only one place where env vars / feature flags are enabled (tilt-settings.yaml) vs. overwriting them here hard-coded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I just copied that over from my own set up. Just to clarify are we good to remove those env vars and just have it run tilt-up?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the kind-reset target could be useful - but we should make the cluster name explicit in the kind-cluster target to ensure they're always targetting the same cluster.

The tilt up target doesn't seem that useful on top of the flow make kind-cluster && tilt up and, as @ykakarap said, we shouldn't be including env variables there.

Makefile Show resolved Hide resolved
Makefile Outdated
@@ -669,6 +669,14 @@ test-capd-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests
kind-cluster: ## Create a new kind cluster designed for development with Tilt
hack/kind-install-for-capd.sh

.PHONY: kind-reset
kind-reset: ## Destroys the "capi-test" kind cluster.
kind delete cluster --name=capi-test || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we can always assume that the kind cluster's name will be capi-test given that make kind-cluster can create clusters with other names. We can either enforce the cluster name as @killianmuldoon suggested or have the kind-reset target also support the CAPI_KIND_CLUSTER_NAME like the kind-cluster target does.

I dont have strong opinions on either options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use the same logic here as we have in the script. Which means use the env var CAPI_KIND_CLUSTER_NAME if it is set and fallback to capi-test if the env var is not set

Makefile Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 24, 2022
@Jont828
Copy link
Contributor Author

Jont828 commented Aug 24, 2022

@sbueringer I've added make targets for removing .tiltbuild files and local charts per your comment in #7018, what do you think about this approach?

Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated

.PHONY: clean-bin
clean-bin: ## Remove all generated binaries
rm -rf $(BIN_DIR)
rm -rf $(TOOLS_BIN_DIR)

.PHONY: clean-tilt
clean-tilt: ## Remove all files in .tiltbuild
rm -rf ./tiltbuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am good with adding this target but just FYI tilt-prepare takes care of updating the files in .tiltbuild if it observes any changes. Dropping this comment here incase this target was just added as part of the "pull the correct chart" problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I added it since @sbueringer mentioned a while back we didn't have any way to clean up unused files in .tiltbuild. For example when we change the output filename it won't remove the old file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't remove the .tiltbuild stuff in e.g. docker, controlplane, bootstrap, right? I guess we should remove ./**/.tiltbuild ?

This also won't clean artifacts in provider repos, so it could be slightly confusing, but those are just binaries I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the .tiltbuild folders under providers only contain the manager binaries for now. I think we should be fine with just cleaning up .tiltbuild in the CAPI root.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's delete all of them. Only deleting one is a bit inconsequential. I'm fine with just listing the 4 rm -rf calls here. After all they are pretty stable in core CAPI

Makefile Show resolved Hide resolved
@fabriziopandini
Copy link
Member

nice improvement, lgtm pending open comments
here (or in a follow up PR) we should go trough developers' docs and promote usage of this new targets

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 25, 2022
@Jont828
Copy link
Contributor Author

Jont828 commented Aug 25, 2022

@fabriziopandini Sure thing. Do we want to put it on the Tilt dev page?

Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@Jont828 Jont828 force-pushed the make-tilt branch 2 times, most recently from b3b4d81 to d76b044 Compare August 26, 2022 21:48
@Jont828
Copy link
Contributor Author

Jont828 commented Aug 26, 2022

I added some docs, PTAL when you have some time!

Makefile Outdated Show resolved Hide resolved
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small nit, otherwise lgtm

Makefile Outdated
@@ -669,6 +672,14 @@ test-capd-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests
kind-cluster: ## Create a new kind cluster designed for development with Tilt
hack/kind-install-for-capd.sh

.PHONY: kind-reset
kind-reset: ## Destroys the kind cluster with the name $CAPI_KIND_CLUSTER_NAME.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kind-reset: ## Destroys the kind cluster with the name $CAPI_KIND_CLUSTER_NAME.
clean-kind: ## Cleanup the kind cluster with the name $CAPI_KIND_CLUSTER_NAME.

Also, this target should be moved down in the file so it appears under the clean section (before clean tilt)

Comment on lines 304 to 306
After stopping Tilt, you can clean up your kind cluster and development environment by running

```bash
make kind-reset
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: should this be part of make clean (like all the clean targets)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why they make sense as 2 different targets. make clean is to delete all auto-generated files that are now part of the project folder strucutre. make kind-reset doesn't really fall under the same category.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case do we still want to rename make kind-reset to make clean-tilt? I had it next to make kind-cluster in the file as it's the inverse operation.

Copy link
Contributor

@ykakarap ykakarap Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case do we still want to rename make kind-reset to make clean-tilt?

Did you mean rename kind-reset to clean-kind? If so, then yeah, I think that sounds good. (As suggested here: #7097 (comment))

I had it next to make kind-cluster in the file as it's the inverse operation.

Having make kind-reset next to make kind-cluster makes sense, since as you said they it is the inverse operation.

@Jont828
Copy link
Contributor Author

Jont828 commented Sep 1, 2022

Alright I pushed some changes and squashed, I think we're ready for a last pass of reviews!

Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2022
Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Makefile Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 1, 2022
Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 2, 2022
@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 2, 2022
@k8s-ci-robot k8s-ci-robot merged commit 0043155 into kubernetes-sigs:main Sep 2, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants