Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 tilt: set CR logger in tilt-prepare, fix allowed contexts #8919

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ kubectl_cmd = "kubectl"
default_build_engine = "docker"
kubernetes_version = "v1.27.3"

if str(local("command -v " + kubectl_cmd + " || true", quiet = True)) == "":
fail("Required command '" + kubectl_cmd + "' not found in PATH")

load("ext://uibutton", "cmd_button", "location", "text_input")

# detect if docker images should be built using podman
if "Podman Engine" in str(local("docker version || podman version", quiet = True)):
default_build_engine = "podman"

# set defaults
version_settings(True, ">=0.30.8")

Expand All @@ -36,6 +29,13 @@ os.putenv("CAPI_KIND_CLUSTER_NAME", settings.get("kind_cluster_name"))

allow_k8s_contexts(settings.get("allowed_contexts"))

if str(local("command -v " + kubectl_cmd + " || true", quiet = True)) == "":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently allow_k8s_contexts has to be run above "local" otherwise the local calls fail if the context is not a kind cluster or something.

(ran into this issue with a cluster created via CAPV)

fail("Required command '" + kubectl_cmd + "' not found in PATH")

# detect if docker images should be built using podman
if "Podman Engine" in str(local("docker version || podman version", quiet = True)):
default_build_engine = "podman"

os_name = str(local("go env GOOS")).rstrip("\n")
os_arch = str(local("go env GOARCH")).rstrip("\n")

Expand Down
3 changes: 3 additions & 0 deletions hack/tools/tilt-prepare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func main() {
// This makes it easier to see what clusterctl is doing and to debug it.
logf.SetLogger(logf.NewLogger(logf.WithThreshold(pointer.Int(5))))

// Set controller-runtime logger as well.
ctrl.SetLogger(klog.Background())
Copy link
Member Author

@sbueringer sbueringer Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this at some point CR complains (in the log in the Tilt UI) that no logger has been set. We do this in all our other binaries as well


klog.Infof("[main] started\n")
start := time.Now()

Expand Down