environment

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

func Register

func Register(b *bucket.Buckets)

Types

type Bucket added in v1.4.0

type Bucket struct{}

func NewEnvironmentBucket

func NewEnvironmentBucket(_ bucket.Config) (*Bucket, error)

func (Bucket) Run added in v1.4.0

func (n Bucket) Run() (bucket.Results, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL