diff --git a/Tiltfile b/Tiltfile index c1000e7718..f806ea5db0 100644 --- a/Tiltfile +++ b/Tiltfile @@ -86,6 +86,7 @@ def enable_provider(name): name = p.get("name", name) context = p.get("context") go_main = p.get("go_main") + label = p.get("label", name) # Prefix each live reload dependency with context. For example, for if the context is # test/infra/docker and main.go is listed as a dep, the result is test/infra/docker/main.go. This adjustment is @@ -97,9 +98,10 @@ def enable_provider(name): # Set up a local_resource build of the provider's manager binary. The provider is expected to have a main.go in # manager_build_path or the main.go must be provided via go_main option. The binary is written to .tiltbuild/manager. local_resource( - name + "_manager", + label.lower() + "_binary", cmd = "cd " + context + ';mkdir -p .tiltbuild;CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags \'-extldflags "-static"\' -o .tiltbuild/manager ' + go_main, deps = live_reload_deps, + labels = [label, "ALL.binaries"], ) additional_docker_helper_commands = p.get("additional_docker_helper_commands", "") @@ -139,9 +141,17 @@ def enable_provider(name): os.environ.update(substitutions) # Apply the kustomized yaml for this provider - yaml = str(kustomizesub(context + "/config")) + yaml = str(kustomizesub(context + "/config/tls")) k8s_yaml(blob(yaml)) + manager_name = p.get("manager_name") + if manager_name: + k8s_resource( + workload = manager_name, + new_name = label.lower() + "_controller", + labels = [label, "ALL.controllers"], + ) + def kustomizesub(folder): yaml = local('kustomize build {}'.format(folder), quiet=True) return yaml diff --git a/tilt-provider.json b/tilt-provider.json index d02d4c0b9b..3d91889983 100644 --- a/tilt-provider.json +++ b/tilt-provider.json @@ -1,10 +1,18 @@ { "name": "metal3-bmo", "config": { - "kustomize_config": false, "image": "quay.io/metal3-io/baremetal-operator", "live_reload_deps": [ - "apis", "cmd", "pkg", "config", "controllers", "go.mod", "go.sum", "main.go" - ] + "apis", + "cmd", + "pkg", + "config", + "controllers", + "go.mod", + "go.sum", + "main.go" + ], + "label": "BMO", + "manager_name": "baremetal-operator-controller-manager" } }