Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if str(local("command -v " + helm_cmd + " || true", quiet = True)) == "":
settings = {
"helm_installation_name": "kgateway",
"helm_installation_namespace": "kgateway-system",
"helm_values_files": ["./test/kubernetes/e2e/tests/manifests/common-recommendations.yaml"],
"helm_values_files": ["./tilt-values.yaml"],
}

tilt_file = "./tilt-settings.yaml" if os.path.exists("./tilt-settings.yaml") else "./tilt-settings.json"
Expand All @@ -30,10 +30,13 @@ kgateway_installed_cmd = "{0} -n {1} status {2} || true".format(helm_cmd, settin
kgateway_status = str(local(kgateway_installed_cmd, quiet = True))
kgateway_installed = "STATUS: deployed" in kgateway_status

# Base image for kgateway - should match the one in Makefile
envoy_image = "quay.io/solo-io/envoy-gloo:1.36.2-patch1"

tilt_helper_dockerfile = """
# Tilt image
# Tilt helper image for live reloading support and debugger
FROM golang:latest as tilt-helper
# Install delve. Note this should be kept in step with the Go release minor version.
# Install delve debugger. Note this should be kept in step with the Go release minor version.
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Support live reloading with Tilt
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/tilt-dev/rerun-process-wrapper/master/restart.sh && \
Expand All @@ -43,19 +46,25 @@ RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com
"""

tilt_dockerfile = """
FROM golang:latest as tilt
FROM $envoy_image as tilt
ENV DEBIAN_FRONTEND=noninteractive
# Install wget for probes and update deps (matches cmd/kgateway/Dockerfile)
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install --no-install-recommends -y ca-certificates wget \
&& rm -rf /var/log/*log /var/lib/apt/lists/* /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old
WORKDIR /app
COPY --from=tilt-helper /go/bin/dlv /go/bin/dlv
COPY --from=tilt-helper /process.txt .
COPY --from=tilt-helper /start.sh .
COPY --from=tilt-helper /restart.sh .
COPY --from=tilt-helper /go/bin/dlv .
COPY $binary_name .
RUN chmod 777 ./$binary_name
COPY $binary_name /usr/local/bin/kgateway
RUN chmod 755 /usr/local/bin/kgateway
"""

standard_entrypoint = "ENTRYPOINT /app/start.sh /app/$binary_name"
debug_entrypoint = "ENTRYPOINT /app/start.sh /go/bin/dlv --listen=0.0.0.0:$debug_port --api-version=2 --headless=true --only-same-user=false --accept-multiclient --check-go-version=false exec --continue /app/$binary_name"
standard_entrypoint = "ENTRYPOINT /app/start.sh /usr/local/bin/kgateway"
debug_entrypoint = "ENTRYPOINT /app/start.sh /go/bin/dlv --listen=0.0.0.0:$debug_port --api-version=2 --headless=true --only-same-user=false --accept-multiclient --check-go-version=false exec --continue /usr/local/bin/kgateway"

get_resources_cmd = "{0} -n {1} template {2} --include-crds install/helm/kgateway/ --set image.pullPolicy='Never' --set image.registry=ghcr.io/kgateway-dev --set image.tag='{3}'".format(helm_cmd, settings.get("helm_installation_namespace"), settings.get("helm_installation_name"), image_tag)
for f in settings.get("helm_values_files") :
Expand Down Expand Up @@ -111,8 +120,9 @@ def build_docker_image(provider):

dockerfile_contents = dockerfile_contents.replace("$binary_name", provider.get("binary_name"))
dockerfile_contents = dockerfile_contents.replace("$debug_port", str(provider.get("debug_port")))
dockerfile_contents = dockerfile_contents.replace("$envoy_image", envoy_image)

binary_path = provider.get("binary_path", "/app/" + provider.get("binary_name"))
binary_path = provider.get("binary_path", "/usr/local/bin/kgateway")

# Build the image and sync it on binary file changes
# Ref: https://docs.tilt.dev/api.html#api.local_resource
Expand Down Expand Up @@ -229,7 +239,7 @@ def install_kgateway():
def validate_registry() :
usingLocalRegistry = str(local(kubectl_cmd + " get cm -n kube-public local-registry-hosting || true", quiet = True))
if not usingLocalRegistry:
fail("default_registry is required when not using a local registry. create cluster using ctlptl.")
print("WARN: local-registry-hosting configmap not found. Ensure you have a valid registry setup or are using Kind with image loading.")

def install_metallb():
if not settings["metal_lb"]:
Expand Down
2 changes: 1 addition & 1 deletion tilt-settings.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

helm_installation_name: kgateway
helm_values_files:
- ./test/e2e/tests/manifests/common-recommendations.yaml
- ./tilt-values.yaml
helm_installation_namespace: kgateway-system

enabled_providers:
Expand Down
19 changes: 19 additions & 0 deletions tilt-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Tilt-specific values for local development with kgateway
# This file sets up the controller for local development and debugging

# Image settings for local development
image:
registry: ghcr.io/kgateway-dev

# Configure validation behavior
validation:
level: strict

# Controller configuration
controller:
# Enable debug logging for troubleshooting
logLevel: debug
# Extra environment variables for the controller
extraEnv:
# This must be set to "false" (not disabled) for Tilt/debugging to work properly
KGW_DISABLE_LEADER_ELECTION: "false"