Skip to content

Commit 6ab296b

Browse files
committed
fix(devenv): CRDs got deleted when forcing a reload
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
1 parent e4880ac commit 6ab296b

File tree

5 files changed

+101
-17
lines changed

5 files changed

+101
-17
lines changed

devenv/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/*

devenv/Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
1-
tilt-up:
2-
DOCKER_BUILDKIT=0 tilt up
1+
detected_OS := $(shell uname -s)
2+
real_OS := $(detected_OS)
3+
arch := $(shell uname -m)
4+
ifeq ($(detected_OS),Darwin)
5+
detected_OS := mac
6+
real_OS := darwin
7+
endif
8+
ifeq ($(detected_OS),Linux)
9+
detected_OS := linux
10+
real_OS := linux
11+
endif
12+
13+
14+
## Location to install dependencies to
15+
LOCALBIN ?= $(shell pwd)/bin
16+
$(LOCALBIN):
17+
mkdir -p $(LOCALBIN)
18+
19+
## Tool Binaries
20+
TILT ?= $(LOCALBIN)/tilt
21+
22+
## Tool Versions
23+
TILT_VERSION := 0.33.22
24+
25+
.PHONY: tilt
26+
.PHONY: $(TILT)
27+
tilt: $(TILT) ## Download tilt locally if necessary. Architecture is locked at x86_64.
28+
$(TILT): $(LOCALBIN)
29+
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
30+
31+
tilt-up: tilt
32+
$(LOCALBIN)/tilt up

devenv/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Kubeflow Notebooks -- Dev Environment
2+
3+
## Requirements
4+
5+
- Go >= 1.22
6+
- Helm >= 3.16.1
7+
8+
## Tilt
9+
10+
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.
11+
12+
See this example using a kind cluster:
13+
14+
```bash
15+
kind create cluster
16+
```
17+
18+
then:
19+
20+
```bash
21+
make tilt-up
22+
```
23+
24+
Hit `space` to open the Tilt dashboard in your browser and here you can see the logs and status of every resource deployed.
25+
26+
27+
## Troubleshooting
28+
29+
### "Build Failed: failed to dial gRPC: unable to upgrade to h2c, received 404"
30+
31+
If you see the following error message when tilt builds the image, try setting `DOCKER_BUILDKIT=0`:
32+
33+
```bash
34+
DOCKER_BUILDKIT=0 make tilt-up
35+
```

devenv/Tiltfile

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,37 @@ k8s_yaml(overridden_manifests, allow_duplicates=True)
2222

2323
k8s_resource(
2424
workload="workspace-controller-controller-manager",
25+
new_name="controller",
26+
labels="controller",
27+
resource_deps=[
28+
"cert-manager"
29+
]
30+
)
31+
32+
k8s_resource(
33+
# workload="workspace-controller-controller-manager",
34+
new_name="controller-certs",
2535
objects=[
26-
"workspace-controller-system:namespace",
27-
"workspacekinds.kubeflow.org:customresourcedefinition",
28-
"workspaces.kubeflow.org:customresourcedefinition",
29-
"workspace-controller-controller-manager:serviceaccount",
30-
"workspace-controller-leader-election-role:role",
31-
"workspace-controller-manager-role:clusterrole",
32-
"workspace-controller-workspace-editor-role:clusterrole",
33-
"workspace-controller-workspace-viewer-role:clusterrole",
34-
"workspace-controller-workspacekind-editor-role:clusterrole",
35-
"workspace-controller-workspacekind-viewer-role:clusterrole",
36-
"workspace-controller-leader-election-rolebinding:rolebinding",
37-
"workspace-controller-manager-rolebinding:clusterrolebinding",
38-
"workspace-controller-serving-cert:certificate",
39-
"workspace-controller-selfsigned-issuer:issuer",
40-
"workspace-controller-validating-webhook-configuration:validatingwebhookconfiguration"
36+
"workspace-controller-serving-cert:certificate",
37+
"workspace-controller-selfsigned-issuer:issuer"
4138
],
39+
# objects=[
40+
# "workspace-controller-system:namespace",
41+
# "workspacekinds.kubeflow.org:customresourcedefinition",
42+
# "workspaces.kubeflow.org:customresourcedefinition",
43+
# "workspace-controller-controller-manager:serviceaccount",
44+
# "workspace-controller-leader-election-role:role",
45+
# "workspace-controller-manager-role:clusterrole",
46+
# "workspace-controller-workspace-editor-role:clusterrole",
47+
# "workspace-controller-workspace-viewer-role:clusterrole",
48+
# "workspace-controller-workspacekind-editor-role:clusterrole",
49+
# "workspace-controller-workspacekind-viewer-role:clusterrole",
50+
# "workspace-controller-leader-election-rolebinding:rolebinding",
51+
# "workspace-controller-manager-rolebinding:clusterrolebinding",
52+
# "workspace-controller-serving-cert:certificate",
53+
# "workspace-controller-selfsigned-issuer:issuer",
54+
# "workspace-controller-validating-webhook-configuration:validatingwebhookconfiguration"
55+
# ],
4256
labels="controller",
4357
resource_deps=[
4458
"cert-manager"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
load("ext://namespace", "namespace_create")
2+
13
# Disable analytics
24
analytics_settings(False)
35

46
update_settings(k8s_upsert_timeout_secs = 120)
7+
8+
namespace_create("workspace-controller-system")

0 commit comments

Comments
 (0)