-
Notifications
You must be signed in to change notification settings - Fork 40
feat: setup tilt for easier local controller development #220
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
base: notebooks-v2
Are you sure you want to change the base?
feat: setup tilt for easier local controller development #220
Conversation
/assign @thesuperzapper @ederign |
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.
@Al-Pragliola thanks so much for your work on this!
So we can merge it, can you make the following changes:
- Lets scope all this within the
workspaces/controller
folder, rather than having things in the root of this repo. - Lets create a
DEVELOPMENT.md
in the root ofworkspaces/controller
which explains the steps required to run a dev version of the controller with tilt (on any cluster the user might have in their kubecontext, or with kind if they want a clean setup)
In a future PR, we can then have a development guide in the workspaces/backend
folder which just points to the controller one as a "first step" before explaining how to use make run
in that case (which does not need tilt, at least at this stage).
helm_repo( | ||
name="jetstack", | ||
url="https://charts.jetstack.io", | ||
resource_name="jetstack-repo", | ||
labels=["common"] | ||
) | ||
|
||
helm_resource( | ||
name="cert-manager", | ||
chart="jetstack/cert-manager", | ||
release_name="cert-manager", | ||
namespace="cert-manager", | ||
flags=["--version=v1.17.0", "--set", "crds.enabled=true"], | ||
deps=["namespaces", "cert-manager"], | ||
labels=["common"] | ||
) |
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 think we should not automatically install cert-manager (or other deps), and instead tell the user to install them with specific commands (if they are not already installed on the cluster they are using).
That way we avoid people accidentally breaking prod clusters.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for the feedback @thesuperzapper , in the latest commits:
let me know wdyt 🙏🏼 |
workspaces/controller/DEVELOPMENT.md
Outdated
|
||
- Go >= 1.22 | ||
- Kubectl >= 1.22 | ||
- A Kubernetes cluster (e.g. [kind](https://kind.sigs.k8s.io/)) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
## Getting Started | ||
|
||
This project uses [Tilt](https://tilt.dev/) to manage the development environment. Tilt will watch for changes in the project and automatically rebuild the Docker image and redeploy the application in the **current Kubernetes context**. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
workspaces/controller/DEVELOPMENT.md
Outdated
2. Run the following command to start Tilt: | ||
|
||
```bash | ||
make -C devenv tilt-up |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
should be fixed following the comment #220 (comment)
workspaces/controller/DEVELOPMENT.md
Outdated
2. Run the following command to start Tilt: | ||
|
||
```bash | ||
make -C devenv tilt-up | ||
``` | ||
|
||
3. Hit `space` to open the Tilt dashboard in your browser and here you can see the logs and status of every resource deployed. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
## Requirements | ||
|
||
CERT_MANAGER_VERSION := 1.17.1 |
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.
do we really wanna hard-code the version of CM here? If so, we probably need additional guidance on the CM install above... as directing users to the general Cert Manager install doc is going to end up with them installing whatever the latest version is...
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.
You are right, let's tune down tech debt I have updated the message to
Verifying cert-manager installation...
cert-manager is either not installed or not ready. Please install cert-manager or wait until it becomes ready.
Installation instructions can be found here: https://cert-manager.io/docs/installation/
wdyt?
$(TILT): $(LOCALBIN) | ||
test -s $(LOCALBIN)/tilt || curl -fsSL https://github.com/tilt-dev/tilt/releases/download/v$(TILT_VERSION)/tilt.$(TILT_VERSION).$(detected_OS).$(arch).tar.gz | tar -xz -C $(LOCALBIN) tilt | ||
|
||
tilt-up: tilt check-cert-manager |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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 checking this PR, yes the Makefile had a bug in line 25, cmctl was meant to be in line 26, I fixed it in the latest commit eda5804
.PHONY: $(CMCTL) | ||
cmctl: $(CMCTL) | ||
$(CMCTL): $(LOCALBIN) | ||
test -s $(LOCALBIN)/cmctl || curl -fsSL https://github.com/cert-manager/cmctl/releases/download/v$(CMCTL_VERSION)/cmctl_$(detected_OS)_$(goarch).tar.gz | tar -xz -C $(LOCALBIN) cmctl |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
good catch, fixed thanks
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.
Good news is I was finally able to get tilt-up
to work - thanks for those changes...
I am now facing this error displayed in tilt dashboard:
The controller
error seems to be the real error - so we should investigate that... possibly due to me being on arm64
machine?
I am also confused why the cert-manager-req
check has a red X as its status 🤔
Please advise on both points - thanks!
objects = decode_yaml_stream(manifests) | ||
|
||
for o in objects: | ||
if o["kind"] == "Deployment" and o.get("metadata").get("name") in ["workspace-controller-controller-manager"]: | ||
o["spec"]["template"]["spec"]["securityContext"] = {"runAsNonRoot": False, "readOnlyRootFilesystem": False} | ||
o["spec"]["template"]["spec"]["containers"][0]["imagePullPolicy"] = "Always" | ||
|
||
overridden_manifests = encode_yaml_stream(objects) |
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.
Curious why we are programmatically modifying manifests here... instead of using kustomize
overlays?
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 didn't want to create an overlay for local development, but I am open to do it if the community agrees
8e6fc0b
to
32585fc
Compare
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
32585fc
to
efb3377
Compare
@@ -0,0 +1,71 @@ | |||
# Development Guide |
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.
@Al-Pragliola can we please add something about running the the tests locally before raising a PR:
make lint
make test
(for unit tests without a local kube/kind)make test-e2e
(run intergration tests on a local kube)
As people wont know they need to do this otherwise
closes #41
This PR aims to add Tilt as a local development tool for the project, you can find an initial stub on how to try the PR locally here https://github.com/kubeflow/notebooks/blob/c38ac05c3dad7efd30a5935bbee8a6643baea817/devenv/README.md