-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basics of the api and the deployment with a tiltfile
- Loading branch information
Showing
20 changed files
with
369 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# -*- mode: Starlark -*- | ||
|
||
kubectl_cmd = "kubectl" | ||
|
||
# verify kubectl command exists | ||
if str(local("command -v " + kubectl_cmd + " || true", quiet = True)) == "": | ||
fail("Required command '" + kubectl_cmd + "' not found in PATH") | ||
|
||
# Use kustomize to build the install yaml files | ||
install = kustomize('config/default') | ||
|
||
# Update the root security group. Tilt requires root access to update the | ||
# running process. | ||
objects = decode_yaml_stream(install) | ||
for o in objects: | ||
if o.get('kind') == 'Deployment' and o.get('metadata').get('name') == 'crd-bootstrap-controller-manager': | ||
o['spec']['template']['spec']['securityContext']['runAsNonRoot'] = False | ||
break | ||
|
||
updated_install = encode_yaml_stream(objects) | ||
|
||
# Apply the updated yaml to the cluster. | ||
# Allow duplicates so the e2e test can include this tilt file with other tilt files | ||
# setting up the same namespace. | ||
k8s_yaml(updated_install, allow_duplicates = True) | ||
|
||
load('ext://restart_process', 'docker_build_with_restart') | ||
|
||
# enable hot reloading by doing the following: | ||
# - locally build the whole project | ||
# - create a docker imagine using tilt's hot-swap wrapper | ||
# - push that container to the local tilt registry | ||
# Once done, rebuilding now should be a lot faster since only the relevant | ||
# binary is rebuilt and the hot swat wrapper takes care of the rest. | ||
local_resource( | ||
'crd-bootstrap-controller-binary', | ||
'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/manager ./', | ||
deps = [ | ||
"main.go", | ||
"go.mod", | ||
"go.sum", | ||
"api", | ||
"controllers", | ||
"pkg", | ||
], | ||
) | ||
|
||
# Build the docker image for our controller. We use a specific Dockerfile | ||
# since tilt can't run on a scratch container. | ||
# `only` here is important, otherwise, the container will get updated | ||
# on _any_ file change. We only want to monitor the binary. | ||
# If debugging is enabled, we switch to a different docker file using | ||
# the delve port. | ||
entrypoint = ['/manager'] | ||
dockerfile = 'tilt.dockerfile' | ||
docker_build_with_restart( | ||
'ghcr.io/Skarlso/crd-bootstrap-controller', | ||
'.', | ||
dockerfile = dockerfile, | ||
entrypoint = entrypoint, | ||
only=[ | ||
'./bin', | ||
], | ||
live_update = [ | ||
sync('./bin/manager', '/manager'), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.