Documentation ¶
Index ¶
Constants ¶
const (
KubernetesHostEnv = "KUBERNETES_SERVICE_HOST"
)
Variables ¶
This section is empty.
Functions ¶
func IsTypicalKubernetesEnv ¶
func IsTypicalKubernetesEnv() bool
Since 1.13 you can disable service environment variables [1] thanks to the pull request to add the enableServiceLinks setting [2] but default kubernetes API server ones [3] are still always exported in container kubelet. This is why it's a rather stable way to determine quickly if you are running inside a kubernetes cluster. Of course it's possible to remove that variable from the environment to create a false negative and to add such variable in any environment to create a false positive but it's a bit unlikely.
[1] https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services [2] https://github.com/kubernetes/kubernetes/pull/68754 [3] https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#environment-variables
Types ¶
type EnvironmentBucket ¶
type EnvironmentBucket struct{}
func NewEnvironmentBucket ¶
func NewEnvironmentBucket(config bucket.Config) (*EnvironmentBucket, error)