From 7d41fdeef7fbff4ece70c989f7b5406e4412178a Mon Sep 17 00:00:00 2001 From: Glenn Pratt Date: Fri, 12 Jan 2024 11:15:06 -0800 Subject: [PATCH] Add Tiltfile --- .dockerignore | 4 +++ Tiltfile | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ devbox.json | 7 +++++ devbox.lock | 65 ++++++++++++++++++++++++++++++++++++++++++++ tilt.values.yaml | 9 +++++++ 5 files changed, 155 insertions(+) create mode 100644 .dockerignore create mode 100644 Tiltfile create mode 100644 devbox.json create mode 100644 devbox.lock create mode 100644 tilt.values.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8d5319a3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +# Ignore everything first to avoid context bloat +* + +!dist/linode-cloud-controller-manager-linux-amd64 diff --git a/Tiltfile b/Tiltfile new file mode 100644 index 00000000..2f56e38c --- /dev/null +++ b/Tiltfile @@ -0,0 +1,70 @@ +load("ext://deployment", "deployment_create") +load("ext://k8s_attach", "k8s_attach") +load("ext://restart_process", "docker_build_with_restart") +load("ext://helm_resource", "helm_resource") + +allow_k8s_contexts(k8s_context()) + +# in order to use this registry you must add `127.0.0.1 registry-proxy` in your /etc/hosts +# and add http://registry-proxy:5000 to the list of insecure registries in docker daemon. +load("ext://k8s_attach", "k8s_attach") + +local_resource( + "registry-probe", + serve_cmd="sleep infinity", + readiness_probe=probe( + period_secs=15, + http_get=http_get_action(host="registry-proxy", port=5000, path="/"), + ), + labels=["registry"], +) + +k8s_attach( + "registry-port-forward", + "deployment/docker-registry", + namespace="registry", + port_forwards=[5000], + labels=["registry"], +) +default_registry("registry-proxy:5000", host_from_cluster="docker.local") + +labels = ["ccm-linode"] + +local_resource( + "linode-cloud-controller-manager-linux-amd64", + "make build-linux", + deps=[ + "*.go", + "cloud/**/*.go", + "sentry/**/*.go", + "go.*", + "Makefile", + ], + ignore=["./build/",], + labels=labels, +) + +docker_build_with_restart( + "linode/linode-cloud-controller-manager", + ".", + # dockerfile="./Dockerfile", + entrypoint=["/linode-cloud-controller-manager-linux-amd64"], + ignore=["**/*.go", "go.*"], + live_update=[ + sync("./dist/linode-cloud-controller-manager-linux-amd64", "/linode-cloud-controller-manager-linux-amd64"), + ], +) + +# Avoiding helm_resource because orchestrating `helm install` over an +# argocd app seems to require deleting the app which is slow and upsets pulumi. +chart_yaml = helm( + "deploy/chart", + name="ccm-linode", + namespace="kube-system", + values="./tilt.values.yaml", +) +k8s_yaml(chart_yaml) + +# k8s_resource( +# "ccm-linode", labels=labels +# ) diff --git a/devbox.json b/devbox.json new file mode 100644 index 00000000..e31e894c --- /dev/null +++ b/devbox.json @@ -0,0 +1,7 @@ +{ + "packages": [ + "go_1_17@latest", + "tilt@latest", + "kubernetes-helm@latest" + ] +} diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 00000000..a2391774 --- /dev/null +++ b/devbox.lock @@ -0,0 +1,65 @@ +{ + "lockfile_version": "1", + "packages": { + "go_1_17@latest": { + "last_modified": "2022-11-10T13:14:32Z", + "resolved": "github:NixOS/nixpkgs/72d8853228c9758820c39b8659415b6d89279493#go_1_17", + "source": "devbox-search", + "version": "1.17.13", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/3sz4dvj5wfbm708d2idk5zl2fmbm7v5g-go-1.17.13" + }, + "aarch64-linux": { + "store_path": "/nix/store/a242dvsmkl42p1crw19cc4mp1majvgr9-go-1.17.13" + }, + "x86_64-darwin": { + "store_path": "/nix/store/0kfpsk25ni9zq75pa61xp6lf7al9lk2q-go-1.17.13" + }, + "x86_64-linux": { + "store_path": "/nix/store/s9qsfgwh0m950sfn49gvpqsi41zbxiyq-go-1.17.13" + } + } + }, + "kubernetes-helm@latest": { + "last_modified": "2023-11-19T17:46:56Z", + "resolved": "github:NixOS/nixpkgs/0bf3f5cf6a98b5d077cdcdb00a6d4b3d92bc78b5#kubernetes-helm", + "source": "devbox-search", + "version": "3.13.2", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/bm0hydn3x8qicnnpp1j59affzbh802g6-kubernetes-helm-3.13.2" + }, + "aarch64-linux": { + "store_path": "/nix/store/rlxzcdijanfnr1cycmasxlqqbkhmfllc-kubernetes-helm-3.13.2" + }, + "x86_64-darwin": { + "store_path": "/nix/store/wihx37d21rxyvp5d10ki9qr57mmqa96n-kubernetes-helm-3.13.2" + }, + "x86_64-linux": { + "store_path": "/nix/store/2nsswfqlz4nc2hrbxchz7n98ccg9jfjx-kubernetes-helm-3.13.2" + } + } + }, + "tilt@latest": { + "last_modified": "2023-11-19T17:46:56Z", + "resolved": "github:NixOS/nixpkgs/0bf3f5cf6a98b5d077cdcdb00a6d4b3d92bc78b5#tilt", + "source": "devbox-search", + "version": "0.33.6", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/d0kpgvk6vvb8lvsvmh338zxfnb9b7vp9-tilt-0.33.6" + }, + "aarch64-linux": { + "store_path": "/nix/store/d61h2m341hza65rs8ay04fjmdgwmw1m6-tilt-0.33.6" + }, + "x86_64-darwin": { + "store_path": "/nix/store/30kfkrlyrbk3bzwr524kmqmsygf5a89p-tilt-0.33.6" + }, + "x86_64-linux": { + "store_path": "/nix/store/9yqsnwx8khnbf86z81cyaaqmh4qkfy2i-tilt-0.33.6" + } + } + } + } +} diff --git a/tilt.values.yaml b/tilt.values.yaml new file mode 100644 index 00000000..69df1d62 --- /dev/null +++ b/tilt.values.yaml @@ -0,0 +1,9 @@ +env: +- name: LINODE_HOSTNAME_ONLY_INGRESS + value: "false" +nodeSelector: + node-role.kubernetes.io/master: "true" +secretRef: + apiTokenRef: apiToken + name: linode-api-secret + regionRef: region