kubernetes

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Running = "Running"
)
View Source
const ServiceAccountPath = "/run/secrets/kubernetes.io/serviceaccount"

Variables

This section is empty.

Functions

func Hostname

func Hostname() string

Hostname returns the hostname of the kubernetes pod

func InKubernetes

func InKubernetes() bool

InKubernetes returns true when running inside a kubernetes instance

func KubeRoutine

func KubeRoutine(stopSig chan bool)

func Namespace

func Namespace() string

Namespace returns the namespace of the kubernetes pod

Types

type ItemMetadata

type ItemMetadata struct {
	Name              string            `json:"name"`
	Namespace         string            `json:"namespace"`
	SelfLink          string            `json:"selfLink"`
	UID               string            `json:"uid"`
	ResourceVersion   string            `json:"resourceVersion"`
	CreationTimestamp time.Time         `json:"creationTimestamp"`
	Labels            map[string]string `json:"labels"`
	Annotations       map[string]string `json:"annotations"`
	OwnerReferences   interface{}       `json:"ownerReferences"`
}

type Pod

type Pod struct {
	Metadata ItemMetadata `json:"metadata"`
	Status   PodStatus    `json:"status"`
}

func Me

func Me() Pod

Me returns the pod that is currently running this instance

func MySelf

func MySelf() *Pod

MySelf returns the data of the kubernetes pod

func Pods

func Pods() []Pod

Pods returns a list of the pods in the current deployment

type PodList

type PodList struct {
	Metadata map[string]string `json:"metadata"`
	Items    []Pod             `json:"items"`
}

type PodStatus

type PodStatus struct {
	Phase     string    `json:"phase"`
	HostIP    string    `json:"hostIP"`
	PodIP     string    `json:"podIP"`
	StartTime time.Time `json:"startTime"`
}

type Service

type Service struct {
	Kind       string        `json:"kind"`
	APIVersion string        `json:"apiVersion"`
	Metadata   interface{}   `json:"metadata"`
	Items      []ServiceItem `json:"items"`
}

type ServiceItem

type ServiceItem struct {
	Metadata ItemMetadata    `json:"metadata"`
	Spec     ServiceItemSpec `json:"spec"`
	Status   interface{}     `json:"status"`
}

type ServiceItemSpec

type ServiceItemSpec struct {
	Ports           []ServiceItemSpecPort `json:"ports"`
	Selector        map[string]string     `json:"selector"`
	ClusterIP       string                `json:"clusterIP"`
	SessionAffinity string                `json:"sessionAffinity"`
}

type ServiceItemSpecPort

type ServiceItemSpecPort struct {
	Name       string `json:"name"`
	Protocol   string `json:"protocol"`
	Port       int    `json:"port"`
	TargetPort int    `json:"targetPort"`
}

Jump to

Keyboard shortcuts

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