Skip to content

Commit 13faf9a

Browse files
authored
Fix tilt dev setup (#771)
The tilt setup was outdated and did not match the folder architecture and security context settings anymore.
1 parent b189fe7 commit 13faf9a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Tiltfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def validate_auth():
100100

101101
tilt_helper_dockerfile_header = """
102102
# Tilt image
103-
FROM golang:1.20 as tilt-helper
103+
FROM golang:1.23.6 as tilt-helper
104104
# Support live reloading with Tilt
105105
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \
106106
wget --output-document /start.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/start.sh && \
@@ -109,10 +109,13 @@ RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com
109109

110110
tilt_dockerfile_header = """
111111
FROM gcr.io/distroless/base:debug as tilt
112-
WORKDIR /
112+
WORKDIR /app
113113
COPY --from=tilt-helper /start.sh .
114114
COPY --from=tilt-helper /restart.sh .
115115
COPY manager .
116+
RUN ["/busybox/chmod", "+x", "/app/start.sh", "/app/restart.sh", "/app/manager"]
117+
RUN ["/busybox/chown", "-R", "65532:65532", "/app"]
118+
USER 65532:65532
116119
"""
117120

118121
# Build CAPDO and add feature gates
@@ -135,16 +138,16 @@ def capdo():
135138
# Set up a local_resource build of the provider's manager binary.
136139
local_resource(
137140
"manager",
138-
cmd = 'mkdir -p .tiltbuild;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags \'-extldflags "-static"\' -o .tiltbuild/manager',
139-
deps = ["api", "cloud", "config", "controllers", "exp", "feature", "pkg", "go.mod", "go.sum", "main.go"]
141+
cmd = 'mkdir -p .tiltbuild;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags \'-extldflags "-static"\' -o .tiltbuild/manager ./cmd',
142+
deps = ["api", "cloud", "config", "internal", "cmd", "util", "version", "go.mod", "go.sum"]
140143
)
141144

142145
dockerfile_contents = "\n".join([
143146
tilt_helper_dockerfile_header,
144147
tilt_dockerfile_header,
145148
])
146149

147-
entrypoint = ["sh", "/start.sh", "/manager"]
150+
entrypoint = ["sh", "/app/start.sh", "/app/manager"]
148151
extra_args = settings.get("extra_args")
149152
if extra_args:
150153
entrypoint.extend(extra_args)
@@ -159,8 +162,8 @@ def capdo():
159162
entrypoint = entrypoint,
160163
only = "manager",
161164
live_update = [
162-
sync(".tiltbuild/manager", "/manager"),
163-
run("sh /restart.sh"),
165+
sync(".tiltbuild/manager", "/app/manager"),
166+
run("sh /app/restart.sh"),
164167
],
165168
ignore = ["templates"]
166169
)
@@ -203,7 +206,7 @@ include_user_tilt_files()
203206
load("ext://cert_manager", "deploy_cert_manager")
204207

205208
if settings.get("deploy_cert_manager"):
206-
deploy_cert_manager()
209+
deploy_cert_manager(version=settings.get("cert_manager_version"))
207210

208211
deploy_capi()
209212

scripts/kind-with-registry.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ set -o errexit
1717
set -o nounset
1818
set -o pipefail
1919

20-
2120
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2221
KUBECTL=$REPO_ROOT/hack/tools/bin/kubectl
2322

2423
# desired kind cluster name; default is "capdo"
2524
KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-capdo}"
25+
# Note: Use available kindest/node image versions from https://hub.docker.com/r/kindest/node/tags
26+
KUBERNETES_VERSION="${KUBERNETES_VERSION:-v1.31.14}"
2627

2728
if [[ "$(kind get clusters)" =~ .*"${KIND_CLUSTER_NAME}".* ]]; then
2829
echo "cluster already exists, moving on"
@@ -39,7 +40,7 @@ if [ "${running}" != 'true' ]; then
3940
fi
4041

4142
# create a cluster with the local registry enabled in containerd
42-
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
43+
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --image "kindest/node:${KUBERNETES_VERSION}" --config=-
4344
kind: Cluster
4445
apiVersion: kind.x-k8s.io/v1alpha4
4546
containerdConfigPatches:

0 commit comments

Comments
 (0)