hostinfo: add EnvType for Kubernetes
Signed-off-by: Maisem Ali <maisem@tailscale.com>pull/3103/head
parent
47ace13ac8
commit
2662a1c98c
|
@ -82,6 +82,7 @@ const (
|
||||||
AzureAppService = EnvType("az")
|
AzureAppService = EnvType("az")
|
||||||
AWSFargate = EnvType("fg")
|
AWSFargate = EnvType("fg")
|
||||||
FlyDotIo = EnvType("fly")
|
FlyDotIo = EnvType("fly")
|
||||||
|
Kubernetes = EnvType("k8s")
|
||||||
)
|
)
|
||||||
|
|
||||||
var envType atomic.Value // of EnvType
|
var envType atomic.Value // of EnvType
|
||||||
|
@ -136,6 +137,9 @@ func getEnvType() EnvType {
|
||||||
if inFlyDotIo() {
|
if inFlyDotIo() {
|
||||||
return FlyDotIo
|
return FlyDotIo
|
||||||
}
|
}
|
||||||
|
if inKubernetes() {
|
||||||
|
return Kubernetes
|
||||||
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,3 +216,10 @@ func inFlyDotIo() bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func inKubernetes() bool {
|
||||||
|
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue