Skip to content

Commit f24504d

Browse files
committed
all: remove use old, overloaded of IN_KUBERNETES
Fixes golang/go#34956 Change-Id: Ie6f521eee5995102d6dc13f92ecca6601a68661b Reviewed-on: https://go-review.googlesource.com/c/build/+/201739 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 0dcb7ed commit f24504d

File tree

5 files changed

+4
-26
lines changed

5 files changed

+4
-26
lines changed

buildlet/kube.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ func StartPod(ctx context.Context, kubeClient *kubernetes.Client, podName, hostT
110110
ContainerPort: 80,
111111
},
112112
},
113-
Env: []api.EnvVar{
114-
{
115-
Name: "IN_KUBERNETES",
116-
Value: "1",
117-
},
118-
},
113+
Env: []api.EnvVar{},
119114
},
120115
},
121116
},

cmd/buildlet/buildlet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func listenForCoordinator() {
357357
// registerSignal if non-nil registers shutdown signals with the provided chan.
358358
var registerSignal func(chan<- os.Signal)
359359

360-
var inKube, _ = strconv.ParseBool(os.Getenv("IN_KUBERNETES"))
360+
var inKube = os.Getenv("KUBERNETES_SERVICE_HOST") != ""
361361

362362
// metadataValue returns the GCE metadata instance value for the given key.
363363
// If the metadata is not defined, the returned string is empty.

cmd/buildlet/stage0/stage0.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,7 @@ func buildletURL() string {
302302
}
303303
switch osArch {
304304
case "linux/amd64":
305-
// Issue 25760: the s390x cross-compile builder is
306-
// working under Kubernetes (which sets
307-
// IN_KUBERNETES=1 in the env), but isn't working when
308-
// run under Docker in COS (a Container-Optimized OS
309-
// VM on GCE). Maybe something is hiding the GCE
310-
// metadata service from the COS container now. As a
311-
// test, just hard code the s390x builder:
305+
// For the s390x cross-compile builder:
312306
if os.Getenv("GOARCH") == "s390x" {
313307
return "https://storage.googleapis.com/go-builder-data/buildlet.linux-amd64"
314308
}
@@ -332,7 +326,7 @@ func buildletURL() string {
332326
// The buildlet download URL is located in an env var
333327
// when the buildlet is not running on GCE, or is running
334328
// on Kubernetes.
335-
if !metadata.OnGCE() || os.Getenv("IN_KUBERNETES") == "1" {
329+
if !metadata.OnGCE() || os.Getenv("KUBERNETES_SERVICE_HOST") != "" {
336330
if v := os.Getenv("META_BUILDLET_BINARY_URL"); v != "" {
337331
return v
338332
}

env/linux-arm/scaleway/Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ COPY stage0 /usr/local/bin/stage0
1919

2020
ENV GO_BUILD_KEY_PATH /buildkey/gobuildkey
2121
ENV GO_BUILD_KEY_DELETE_AFTER_READ true
22-
23-
# Not really, but we're in a container like Kubernetes, and this makes the syscall
24-
# package happy:
25-
ENV IN_KUBERNETES 1
26-
2722
ENV GO_BUILDER_ENV host-linux-arm-scaleway
2823

2924
# env specific

env/linux-arm64/Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,3 @@ RUN curl -o /usr/local/bin/stage0 https://storage.googleapis.com/go-builder-dat
2323

2424
ENV GO_BUILD_KEY_DELETE_AFTER_READ true
2525
ENV GO_BUILD_KEY_PATH /buildkey/gobuildkey
26-
27-
# Not really, but we're in a container like Kubernetes, and this makes the syscall
28-
# package happy:
29-
ENV IN_KUBERNETES 1
30-
31-

0 commit comments

Comments
 (0)