зеркало из https://github.com/golang/build.git
all: rename Kube to Container and IsGCE to IsVM
Once containers run on COS instead of Kubernetes, one name (Kube*) is wrong and the other (GCE) is ambiguous. So rename them now to be more specific. No behavior changes. Just renaming in this step, to reduce size of next CL. Updates golang/go#25108 Change-Id: Ib09eb682ef74acbbf6ed50b46074f834ef5e0c0b Reviewed-on: https://go-review.googlesource.com/111639 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Родитель
dc1f665c06
Коммит
14d99737ae
|
@ -91,7 +91,7 @@ func StartNewVM(creds *google.Credentials, instName, hostType string, opts VMOpt
|
|||
if !ok {
|
||||
return nil, fmt.Errorf("invalid host type %q", hostType)
|
||||
}
|
||||
if !hconf.IsGCE() {
|
||||
if !hconf.IsVM() {
|
||||
return nil, fmt.Errorf("host type %q is not a GCE host type", hostType)
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ type PodOpts struct {
|
|||
// configured to speak to it.
|
||||
func StartPod(ctx context.Context, kubeClient *kubernetes.Client, podName, hostType string, opts PodOpts) (*Client, error) {
|
||||
conf, ok := dashboard.Hosts[hostType]
|
||||
if !ok || conf.KubeImage == "" {
|
||||
if !ok || conf.ContainerImage == "" {
|
||||
return nil, fmt.Errorf("invalid builder type %q", hostType)
|
||||
}
|
||||
pod := &api.Pod{
|
||||
|
@ -92,7 +92,7 @@ func StartPod(ctx context.Context, kubeClient *kubernetes.Client, podName, hostT
|
|||
Containers: []api.Container{
|
||||
{
|
||||
Name: "buildlet",
|
||||
Image: imageID(opts.ImageRegistry, conf.KubeImage),
|
||||
Image: imageID(opts.ImageRegistry, conf.ContainerImage),
|
||||
ImagePullPolicy: api.PullAlways,
|
||||
Resources: api.ResourceRequirements{
|
||||
Requests: api.ResourceList{
|
||||
|
|
|
@ -473,7 +473,7 @@ func mayBuildRev(rev buildgo.BuilderRev) bool {
|
|||
if buildConf.IsReverse() && !reversePool.CanBuild(buildConf.HostType) {
|
||||
return false
|
||||
}
|
||||
if buildConf.IsKube() && kubeErr != nil {
|
||||
if buildConf.IsContainer() && kubeErr != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -1438,9 +1438,9 @@ func poolForConf(conf dashboard.BuildConfig) BuildletPool {
|
|||
return testPoolHook(conf)
|
||||
}
|
||||
switch {
|
||||
case conf.IsGCE():
|
||||
case conf.IsVM():
|
||||
return gcePool
|
||||
case conf.IsKube():
|
||||
case conf.IsContainer():
|
||||
return kubePool // Kubernetes
|
||||
case conf.IsReverse():
|
||||
return reversePool
|
||||
|
|
|
@ -207,7 +207,7 @@ func (p *kubeBuildletPool) pollCapacity(ctx context.Context) {
|
|||
|
||||
func (p *kubeBuildletPool) GetBuildlet(ctx context.Context, hostType string, lg logger) (*buildlet.Client, error) {
|
||||
hconf, ok := dashboard.Hosts[hostType]
|
||||
if !ok || !hconf.IsKube() {
|
||||
if !ok || !hconf.IsContainer() {
|
||||
return nil, fmt.Errorf("kubepool: invalid host type %q", hostType)
|
||||
}
|
||||
if kubeErr != nil {
|
||||
|
|
|
@ -64,7 +64,7 @@ func main() {
|
|||
if !ok {
|
||||
log.Fatalf("unknown host type %q", *hostType)
|
||||
}
|
||||
if !hconf.IsGCE() {
|
||||
if !hconf.IsVM() {
|
||||
log.Fatalf("host type %q is not a GCE host type", *hostType)
|
||||
}
|
||||
if *vmImage != "" {
|
||||
|
|
|
@ -278,7 +278,7 @@ func (b *Build) make() error {
|
|||
}
|
||||
|
||||
var hostArch string // non-empty if we're cross-compiling (s390x)
|
||||
if b.MakeOnly && bc.IsKube() && (bc.GOARCH() != "amd64" && bc.GOARCH() != "386") {
|
||||
if b.MakeOnly && bc.IsContainer() && (bc.GOARCH() != "amd64" && bc.GOARCH() != "386") {
|
||||
hostArch = "amd64"
|
||||
}
|
||||
|
||||
|
|
|
@ -27,20 +27,20 @@ var Builders = map[string]BuildConfig{}
|
|||
var Hosts = map[string]*HostConfig{
|
||||
"host-linux-kubestd": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE.",
|
||||
KubeImage: "linux-x86-std-kube:latest",
|
||||
ContainerImage: "linux-x86-std-kube:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
SSHUsername: "root",
|
||||
},
|
||||
"host-linux-armhf-cross": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE built from env/crosscompile/linux-armhf-jessie",
|
||||
KubeImage: "linux-armhf-jessie:latest",
|
||||
ContainerImage: "linux-armhf-jessie:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
"host-linux-armel-cross": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE built from env/crosscompile/linux-armel-stretch",
|
||||
KubeImage: "linux-armel-stretch:latest",
|
||||
ContainerImage: "linux-armel-stretch:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
|
@ -58,31 +58,31 @@ var Hosts = map[string]*HostConfig{
|
|||
},
|
||||
"host-nacl-kube": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE.",
|
||||
KubeImage: "linux-x86-nacl:latest",
|
||||
ContainerImage: "linux-x86-nacl:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
"host-s390x-cross-kube": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE.",
|
||||
KubeImage: "linux-s390x-stretch:latest",
|
||||
ContainerImage: "linux-s390x-stretch:latest",
|
||||
buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
"host-linux-x86-alpine": &HostConfig{
|
||||
Notes: "Kubernetes alpine container on GKE.",
|
||||
KubeImage: "linux-x86-alpine:latest",
|
||||
ContainerImage: "linux-x86-alpine:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64-static",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/usr/lib/go"},
|
||||
},
|
||||
"host-linux-clang": &HostConfig{
|
||||
Notes: "Kubernetes container on GKE with clang.",
|
||||
KubeImage: "linux-x86-clang:latest",
|
||||
ContainerImage: "linux-x86-clang:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
"host-linux-sid": &HostConfig{
|
||||
Notes: "Debian sid, updated occasionally.",
|
||||
KubeImage: "linux-x86-sid:latest",
|
||||
ContainerImage: "linux-x86-sid:latest",
|
||||
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
|
||||
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
|
||||
},
|
||||
|
@ -451,16 +451,16 @@ func init() {
|
|||
if c.VMImage != "" {
|
||||
nSet++
|
||||
}
|
||||
if c.KubeImage != "" {
|
||||
if c.ContainerImage != "" {
|
||||
nSet++
|
||||
}
|
||||
if c.IsReverse {
|
||||
nSet++
|
||||
}
|
||||
if nSet != 1 {
|
||||
panic(fmt.Sprintf("exactly one of VMImage, KubeImage, IsReverse must be set for host %q; got %v", key, nSet))
|
||||
panic(fmt.Sprintf("exactly one of VMImage, ContainerImage, IsReverse must be set for host %q; got %v", key, nSet))
|
||||
}
|
||||
if c.buildletURLTmpl == "" && (c.VMImage != "" || c.KubeImage != "") {
|
||||
if c.buildletURLTmpl == "" && (c.VMImage != "" || c.ContainerImage != "") {
|
||||
panic(fmt.Sprintf("missing buildletURLTmpl for host type %q", key))
|
||||
}
|
||||
}
|
||||
|
@ -484,9 +484,9 @@ type HostConfig struct {
|
|||
buildletURLTmpl string
|
||||
|
||||
// Exactly 1 of these must be set:
|
||||
VMImage string // e.g. "openbsd-amd64-60"
|
||||
KubeImage string // e.g. "linux-buildlet-std:latest" (suffix after "gcr.io/<PROJ>/")
|
||||
IsReverse bool // if true, only use the reverse buildlet pool
|
||||
VMImage string // e.g. "openbsd-amd64-60"
|
||||
ContainerImage string // e.g. "linux-buildlet-std:latest" (suffix after "gcr.io/<PROJ>/")
|
||||
IsReverse bool // if true, only use the reverse buildlet pool
|
||||
|
||||
// GCE options, if VMImage != ""
|
||||
machineType string // optional GCE instance type
|
||||
|
@ -606,11 +606,11 @@ func (c *BuildConfig) Env() []string {
|
|||
|
||||
func (c *BuildConfig) IsReverse() bool { return c.hostConf().IsReverse }
|
||||
|
||||
func (c *BuildConfig) IsKube() bool { return c.hostConf().IsKube() }
|
||||
func (c *HostConfig) IsKube() bool { return c.KubeImage != "" }
|
||||
func (c *BuildConfig) IsContainer() bool { return c.hostConf().IsContainer() }
|
||||
func (c *HostConfig) IsContainer() bool { return c.ContainerImage != "" }
|
||||
|
||||
func (c *BuildConfig) IsGCE() bool { return c.hostConf().IsGCE() }
|
||||
func (c *HostConfig) IsGCE() bool { return c.VMImage != "" }
|
||||
func (c *BuildConfig) IsVM() bool { return c.hostConf().IsVM() }
|
||||
func (c *HostConfig) IsVM() bool { return c.VMImage != "" }
|
||||
|
||||
func (c *BuildConfig) GOOS() string { return c.Name[:strings.Index(c.Name, "-")] }
|
||||
|
||||
|
@ -833,9 +833,9 @@ func (c *HostConfig) PoolName() string {
|
|||
switch {
|
||||
case c.IsReverse:
|
||||
return "Reverse (dedicated machine/VM)"
|
||||
case c.IsGCE():
|
||||
case c.IsVM():
|
||||
return "GCE VM"
|
||||
case c.IsKube():
|
||||
case c.IsContainer():
|
||||
return "Kubernetes container"
|
||||
}
|
||||
panic("unknown builder type")
|
||||
|
@ -849,9 +849,9 @@ func (c *HostConfig) IsHermetic() bool {
|
|||
switch {
|
||||
case c.IsReverse:
|
||||
return c.HermeticReverse
|
||||
case c.IsGCE():
|
||||
case c.IsVM():
|
||||
return true
|
||||
case c.IsKube():
|
||||
case c.IsContainer():
|
||||
return true
|
||||
}
|
||||
panic("unknown builder type")
|
||||
|
@ -1459,7 +1459,7 @@ func addBuilder(c BuildConfig) {
|
|||
}
|
||||
|
||||
types := 0
|
||||
for _, fn := range []func() bool{c.IsReverse, c.IsKube, c.IsGCE} {
|
||||
for _, fn := range []func() bool{c.IsReverse, c.IsContainer, c.IsVM} {
|
||||
if fn() {
|
||||
types++
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче