Skip to content

Commit bdfd194

Browse files
committed
all: remove legacy gomote API and SSH implementation
This removes the original API used to instantiate remote buildlet and gomote instances. This also removes the original gomote SSH access implementation. This API has been replaced with a GRPC based API. The SSH functionality has been replaced with an implementation which uses certificate authentication. Gomote client changes will follow this CL once in-flight changes have been submitted. Updates golang/go#47521 Fixes golang/go#54735 Change-Id: Idfd7b95eb7ed64637e74c3c0149e0bff7027f507 Reviewed-on: https://go-review.googlesource.com/c/build/+/430279 Run-TryBot: Carlos Amedee <carlos@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
1 parent 3ccb7e9 commit bdfd194

File tree

6 files changed

+15
-974
lines changed

6 files changed

+15
-974
lines changed

cmd/coordinator/coordinator.go

+4-33
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,6 @@ const (
134134
maxStatusDone = 30
135135
)
136136

137-
// httpRouter is the coordinator's handler, routing traffic to one of
138-
// two locations:
139-
// 1. a buildlet, from gomote clients (if X-Buildlet-Proxy is set)
140-
// 2. traffic to the coordinator itself (the default)
141-
func httpRouter(next http.Handler) http.Handler {
142-
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
143-
if r.Header.Get("X-Buildlet-Proxy") != "" {
144-
requireBuildletProxyAuth(http.HandlerFunc(proxyBuildletHTTP)).ServeHTTP(w, r)
145-
return
146-
}
147-
next.ServeHTTP(w, r)
148-
})
149-
}
150-
151137
var validHosts = map[string]bool{
152138
"farmer.golang.org": true,
153139
"build.golang.org": true,
@@ -248,14 +234,8 @@ func main() {
248234
// TODO(golang.org/issue/36841): remove after key functions are moved into
249235
// a shared package.
250236
pool.SetBuilderMasterKey(masterKey())
251-
252237
sp := remote.NewSessionPool(context.Background())
253-
// TODO(go.dev/issue/54735): remove while legacy gomote implementation is being removed.
254-
isRemoteBuildlet := func(instName string) bool {
255-
return isGCERemoteBuildlet(instName) || sp.IsSession(instName)
256-
}
257-
258-
err := pool.InitGCE(sc, &basePinErr, isRemoteBuildlet, *buildEnvName, *mode)
238+
err := pool.InitGCE(sc, &basePinErr, sp.IsSession, *buildEnvName, *mode)
259239
if err != nil {
260240
if *mode == "" {
261241
*mode = "dev"
@@ -283,7 +263,7 @@ func main() {
283263
if *mode == "prod" || (*mode == "dev" && *devEnableEC2) {
284264
// TODO(golang.org/issues/38337) the coordinator will use a package scoped pool
285265
// until the coordinator is refactored to not require them.
286-
ec2Pool := mustCreateEC2BuildletPool(sc, isRemoteBuildlet)
266+
ec2Pool := mustCreateEC2BuildletPool(sc, sp.IsSession)
287267
defer ec2Pool.Close()
288268
}
289269

@@ -384,8 +364,6 @@ func main() {
384364
mux.HandleFunc("/status/post-submit-active.json", handlePostSubmitActiveJSON)
385365
mux.Handle("/dashboard", dashV2)
386366
mux.HandleFunc("/queues", handleQueues)
387-
mux.Handle("/buildlet/create", requireBuildletProxyAuth(http.HandlerFunc(handleBuildletCreate)))
388-
mux.Handle("/buildlet/list", requireBuildletProxyAuth(http.HandlerFunc(handleBuildletList)))
389367
if *mode == "dev" {
390368
// TODO(crawshaw): do more in dev mode
391369
gce.BuildletPool().SetEnabled(*devEnableGCE)
@@ -410,7 +388,7 @@ func main() {
410388
if err != nil {
411389
return nil, fmt.Errorf("unable to retrieve keys for SSH Server: %v", err)
412390
}
413-
return remote.NewSSHServer(*sshAddr, privateKey, publicKey, sshCA, sp, remoteBuildlets)
391+
return remote.NewSSHServer(*sshAddr, privateKey, publicKey, sshCA, sp)
414392
}
415393
sshServ, err := configureSSHServer()
416394
if err != nil {
@@ -428,14 +406,7 @@ func main() {
428406
}
429407
}()
430408
}
431-
432-
h := httpRouter(mux)
433-
if *mode == "dev" {
434-
// Use hostPathHandler in local development mode (only) to improve
435-
// convenience of testing multiple domains that coordinator serves.
436-
h = hostPathHandler(h)
437-
}
438-
log.Fatalln(https.ListenAndServe(context.Background(), h))
409+
log.Fatalln(https.ListenAndServe(context.Background(), mux))
439410
}
440411

441412
// ignoreAllNewWork, when true, prevents addWork from doing anything.

0 commit comments

Comments
 (0)