From 7e9fa0e91abb46d5d5b64b90e6933e9387132b49 Mon Sep 17 00:00:00 2001 From: pavolmarko Date: Thu, 24 Oct 2024 12:16:00 +0200 Subject: [PATCH] buildx: accept full endpoint including port (#1342) If the server provides it, use the "full endpoint". --- go.mod | 4 ++-- go.sum | 4 ++++ internal/cli/cmd/cluster/server_side_buildx.go | 10 +++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 40763c278..737e43f46 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.22.4 toolchain go1.22.6 require ( - buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20240913063847-c2eef2142e48.2 - buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20240913063847-c2eef2142e48.2 + buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20241024100053-9328c9dbe3c7.2 + buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20241024100053-9328c9dbe3c7.2 cloud.google.com/go/artifactregistry v1.14.7 cloud.google.com/go/container v1.31.0 cuelang.org/go v0.4.3 diff --git a/go.sum b/go.sum index 0f769754c..f06cf2c19 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,11 @@ buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20240913063847-c2eef2142e48.2 h1:0OhsdMpM2wrc6kiiF65elq1RGAIJtVAwqSVy2otdUxg= buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20240913063847-c2eef2142e48.2/go.mod h1:JmCtDZVg2rSDkZhpxOJjKTaXaPYkzDM0+3sj8GCe4bU= +buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20241024100053-9328c9dbe3c7.2 h1:7wKTIe/8R+hyV+tJ8wd+p31EDO6SJxgGYscvspBpePo= +buf.build/gen/go/namespace/cloud/grpc/go v1.4.0-20241024100053-9328c9dbe3c7.2/go.mod h1:JtZqElPuO1LR8fgkrjrmk1+XMruqqhENJ/EvVwvm/do= buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20240913063847-c2eef2142e48.2 h1:mUxWKHaQkTjvejwtXDZhPQNxOowoo98DM+MfJT/4Ryw= buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20240913063847-c2eef2142e48.2/go.mod h1:0PjR3jll8A76n54imjLyp/iHG8iGG+f235z23TgNsLc= +buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20241024100053-9328c9dbe3c7.2 h1:r9lAANYMzKxKeCMEJFqL0bUi6fJra6WZ6byM78nSuFM= +buf.build/gen/go/namespace/cloud/protocolbuffers/go v1.34.2-20241024100053-9328c9dbe3c7.2/go.mod h1:0PjR3jll8A76n54imjLyp/iHG8iGG+f235z23TgNsLc= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= diff --git a/internal/cli/cmd/cluster/server_side_buildx.go b/internal/cli/cmd/cluster/server_side_buildx.go index 4f35b18cd..c9e9a6e57 100644 --- a/internal/cli/cmd/cluster/server_side_buildx.go +++ b/internal/cli/cmd/cluster/server_side_buildx.go @@ -194,7 +194,7 @@ func wireRemoteBuildxProxy(dockerCli *command.DockerCli, name string, use, defau doCopy := maps.Clone(driverOpts) doCopy["cacert"] = bc.serverCAPath - if err := ng.Update(bc.serverConfig.GetShape().GetMachineArch(), "tcp://"+bc.serverConfig.GetBuildkitEndpoint()+":443", platforms, true, true, nil, "", doCopy); err != nil { + if err := ng.Update(bc.serverConfig.GetShape().GetMachineArch(), getEndpoint(bc.serverConfig), platforms, true, true, nil, "", doCopy); err != nil { return err } } @@ -217,3 +217,11 @@ func wireRemoteBuildxProxy(dockerCli *command.DockerCli, name string, use, defau return nil }) } + +func getEndpoint(builderConfig *builderv1beta.GetBuilderConfigurationResponse) string { + if builderConfig.GetFullBuildkitEndpoint() != "" { + return builderConfig.GetFullBuildkitEndpoint() + } + + return "tcp://" + builderConfig.GetBuildkitEndpoint() + ":443" +}