Skip to content

Commit

Permalink
🏃 allow extra args with tilt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeldeib committed Apr 18, 2020
1 parent 62b7a1d commit 31dd04b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
29 changes: 10 additions & 19 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ default_registry(settings.get("default_registry"))
always_enable_providers = ["core"]

providers = {
"core": {
"context": ".",
"image": "gcr.io/k8s-staging-cluster-api/cluster-api-controller",
"live_reload_deps": [
"main.go",
"go.mod",
"go.sum",
"api",
"cmd",
"controllers",
"errors",
"third_party",
"util",
],
},
"kubeadm-bootstrap": {
"context": "bootstrap/kubeadm",
"image": "gcr.io/k8s-staging-cluster-api/kubeadm-bootstrap-controller",
Expand Down Expand Up @@ -95,7 +80,10 @@ COPY --from=tilt-helper /go/kubernetes/client/bin/kubectl /usr/bin/kubectl
# }
# }
def load_provider_tiltfiles():
provider_repos = settings.get("provider_repos", [])
provider_repos = settings.get("provider_repos", ["."])
if "." not in provider_repos:
provider_repos.append(".")

for repo in provider_repos:
file = repo + "/tilt-provider.json"
provider_details = read_json(file, default = {})
Expand Down Expand Up @@ -156,14 +144,17 @@ def enable_provider(name):
additional_docker_build_commands,
])

# Set up an image build for the provider. The live update configuration syncs the output from the local_resource
# build into the container.
entrypoint = ["sh", "/start.sh", "/manager"]
extra_args = p.get("extra_args")
if extra_args:
entrypoint.extend(extra_args)

docker_build(
ref = p.get("image"),
context = context + "/.tiltbuild/",
dockerfile_contents = dockerfile_contents,
target = "tilt",
entrypoint = ["sh", "/start.sh", "/manager"],
entrypoint = entrypoint,
only = "manager",
live_update = [
sync(context + "/.tiltbuild/manager", "/manager"),
Expand Down
23 changes: 23 additions & 0 deletions docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,29 @@ COPY --from=tilt-helper /usr/bin/docker /usr/bin/docker
COPY --from=tilt-helper /go/kubernetes/client/bin/kubectl /usr/bin/kubectl
```
**extra_args** (Array, default=[]): An array of additional arguments to pass to the main binary configured
for this provider. Each item in the array will be passed is to the manager.
Example:
```json
{
"name": "core",
"config": {
"context": ".",
"image": "gcr.io/k8s-staging-cluster-api/cluster-api-controller",
"extra_args": ["--feature-gates=MachinePool=true"]
}
}
```
With this config, the manager will be invoked with:
```bash
manager --feature-gates=MachinePool=true
```
## Customizing Tilt
If you need to customize Tilt's behavior, you can create files in cluster-api's `tilt.d` directory. This file is ignored
Expand Down
18 changes: 18 additions & 0 deletions tilt-provider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "core",
"config": {
"context": ".",
"image": "gcr.io/k8s-staging-cluster-api/cluster-api-controller",
"live_reload_deps": [
"main.go",
"go.mod",
"go.sum",
"api",
"cmd",
"controllers",
"errors",
"third_party",
"util"
]
}
}

0 comments on commit 31dd04b

Please sign in to comment.