info

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKubernetesApiUrlFromEnv

func GetKubernetesApiUrlFromEnv() (string, error)

GetKubernetesApiUrlFromEnv returns the k8s api url based on the content of standard env var :

KUBERNETES_SERVICE_HOST
KUBERNETES_SERVICE_PORT
in case the above ENV variables doesn't  exist the function returns an empty string and an error

func GetKubernetesConnInfo

func GetKubernetesConnInfo(l golog.MyLogger, defaultReadTimeout time.Duration) (*K8sInfo, ErrorConfig)

GetKubernetesConnInfo returns a K8sInfo with various information retrieved from the current k8s api url K8sInfo.CurrentNamespace contains the current namespace of the running pod K8sInfo.Token contains the bearer authentication token for the running k8s instance in which this pods lives K8sInfo.CaCert contains the certificate of the running k8s instance in which this pods lives

Types

type ErrorConfig

type ErrorConfig struct {
	Err error
	Msg string
}

func (*ErrorConfig) Error

func (e *ErrorConfig) Error() string

Error returns a string with an error and a specifics message

type K8sInfo

type K8sInfo struct {
	CurrentNamespace string `json:"current_namespace"`
	Version          string `json:"version"`
	Token            string `json:"token"`
	CaCert           string `json:"ca_cert"`
}

Jump to

Keyboard shortcuts

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