Documentation ¶
Index ¶
- func GetKubernetesApiUrlFromEnv(l golog.MyLogger) (string, error)
- func GetKubernetesConnInfo(l golog.MyLogger, defaultReadTimeout time.Duration) (*K8sInfo, ErrorConfig)
- func GetKubernetesLatestVersion(l golog.MyLogger) (string, error)
- func GetOsInfo() (*OsInfo, ErrorConfig)
- func GetOsUptime() (string, error)
- func IsRunningInsideKubernetes() bool
- type ErrorConfig
- type K8sInfo
- type OsInfo
- type RuntimeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKubernetesApiUrlFromEnv ¶
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
func GetOsInfo ¶
func GetOsInfo() (*OsInfo, ErrorConfig)
func GetOsUptime ¶
func IsRunningInsideKubernetes ¶
func IsRunningInsideKubernetes() bool
IsRunningInsideKubernetes returns true if running inside k8s orchestrator y checking if KUBERNETES_SERVICE_HOST is defined
Types ¶
type ErrorConfig ¶
func (*ErrorConfig) Error ¶
func (e *ErrorConfig) Error() string
Error returns a string with an error and a specifics message
type RuntimeInfo ¶
type RuntimeInfo struct { Hostname string `json:"hostname"` // host name reported by the kernel. Pid int `json:"pid"` // process id of the caller. PPid int `json:"ppid"` // process id of the caller's parent. Uid int `json:"uid"` // numeric user id of the caller. AppName string `json:"app_name"` // name of this application Version string `json:"version"` // version of this application ParamName string `json:"param_name"` // value of the name parameter (_NO_PARAMETER_NAME_ if name was not set) RemoteAddr string `json:"remote_addr"` // remote client ip address RequestId string `json:"request_id"` // globally unique request id GOOS string `json:"goos"` // operating system GOARCH string `json:"goarch"` // architecture Runtime string `json:"runtime"` // go runtime at compilation time NumGoroutine string `json:"num_goroutine"` // number of go routines OsReleaseName string `json:"os_release_name"` // Linux release Name or _UNKNOWN_ OsReleaseVersion string `json:"os_release_version"` // Linux release Version or _UNKNOWN_ OsReleaseVersionId string `json:"os_release_version_id"` // Linux release VersionId or _UNKNOWN_ NumCPU string `json:"num_cpu"` // number of cpu Uptime string `json:"uptime"` // tells how long this service was started based on an internal variable UptimeOs string `json:"uptime_os"` // tells how long system was started based on /proc/uptime K8sApiUrl string `json:"k8s_api_url"` // url for k8s api based KUBERNETES_SERVICE_HOST K8sVersion string `json:"k8s_version"` // version of k8s cluster K8sLatestVersion string `json:"k8s_latest_version"` // latest version announced in https://kubernetes.io/ K8sCurrentNamespace string `json:"k8s_current_namespace"` // k8s namespace of this container EnvVars []string `json:"env_vars"` // environment variables Headers map[string][]string `json:"headers"` // received headers }