Skip to content

Commit

Permalink
buildx: accept full endpoint including port (#1342)
Browse files Browse the repository at this point in the history
If the server provides it, use the "full endpoint".
  • Loading branch information
pavolmarko authored Oct 24, 2024
1 parent 02c0b54 commit 7e9fa0e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
10 changes: 9 additions & 1 deletion internal/cli/cmd/cluster/server_side_buildx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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"
}

0 comments on commit 7e9fa0e

Please sign in to comment.