kubelet

package
v0.0.0-...-f3e8d88 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubeletHealthPath = "/healthz"
)

Kubelet constants

Variables

This section is empty.

Functions

func PerformKubeletQuery

func PerformKubeletQuery(url string) ([]byte, error)

PerformKubeletQuery performs a GET query against kubelet and return the response body Supports token-based auth TODO: TLS

Types

type ContainerStatus

type ContainerStatus struct {
	Name  string `json:"name,omitempty"`
	Image string `json:"image,omitempty"`
	ID    string `json:"containerID,omitempty"`
}

ContainerStatus contains fields for unmarshalling a Pod.Status.Containers

type KubeUtil

type KubeUtil struct {
	// contains filtered or unexported fields
}

KubeUtil is a struct to hold the kubelet api url Instanciate with NewKubeUtil

func NewKubeUtil

func NewKubeUtil() (*KubeUtil, error)

NewKubeUtil returns a new instance of KubeUtil.

func (*KubeUtil) GetLocalPodList

func (ku *KubeUtil) GetLocalPodList() ([]*Pod, error)

GetLocalPodList returns the list of pods running on the node where this pod is running

func (*KubeUtil) GetNodeInfo

func (ku *KubeUtil) GetNodeInfo() (ip, name string, err error)

GetNodeInfo returns the IP address and the hostname of the node where this pod is running.

func (*KubeUtil) GetPodForContainerID

func (ku *KubeUtil) GetPodForContainerID(containerID string) (*Pod, error)

GetPodForContainerID fetches the podlist and returns the pod running a given container on the node. Returns a nil pointer if not found.

type Pod

type Pod struct {
	Spec     Spec        `json:"spec,omitempty"`
	Status   Status      `json:"status,omitempty"`
	Metadata PodMetadata `json:"metadata,omitempty"`
}

Pod contains fields for unmarshalling a Pod

type PodList

type PodList struct {
	Items []*Pod `json:"items,omitempty"`
}

PodList contains fields for unmarshalling a PodList

type PodMetadata

type PodMetadata struct {
	Name        string            `json:"name,omitempty"`
	UID         string            `json:"uid,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	ResVersion  string            `json:"resourceVersion,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Owners      []PodOwner        `json:"ownerReferences,omitempty"`
}

PodMetadata contains fields for unmarshalling a pod's metadata

type PodOwner

type PodOwner struct {
	Kind string `json:"kind,omitempty"`
	Name string `json:"name,omitempty"`
	ID   string `json:"uid,omitempty"`
}

PodOwner contains fields for unmarshalling a Pod.Metadata.Owners

type PodWatcher

type PodWatcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PodWatcher regularly pools the kubelet for new/changed/removed containers. It keeps an internal state to only send the updated pods.

func NewPodWatcher

func NewPodWatcher() (*PodWatcher, error)

NewPodWatcher creates a new watcher. User call must then trigger PullChanges and ExpireContainers when needed.

func (*PodWatcher) ExpireContainers

func (w *PodWatcher) ExpireContainers() ([]string, error)

ExpireContainers returns a list of container id for containers that are not listed in the podlist anymore. It must be called immediately after a PullChanges.

func (*PodWatcher) GetPodForContainerID

func (w *PodWatcher) GetPodForContainerID(containerID string) (*Pod, error)

GetPodForContainerID fetches the podlist and returns the pod running a given container on the node. Returns a nil pointer if not found. It just proxies the call to its kubeutil.

func (*PodWatcher) PullChanges

func (w *PodWatcher) PullChanges() ([]*Pod, error)

PullChanges pulls a new podlist from the kubelet and returns Pod objects for new / updated pods. Updated pods will be sent entierly, user must replace previous info for these pods.

type Spec

type Spec struct {
	HostNetwork bool   `json:"hostNetwork,omitempty"`
	Hostname    string `json:"hostname,omitempty"` // TODO: does it exist?
	NodeName    string `json:"nodeName,omitempty"`
}

Spec contains fields for unmarshalling a Pod.Spec

type Status

type Status struct {
	HostIP     string            `json:"hostIP,omitempty"`
	PodIP      string            `json:"podIP,omitempty"`
	Containers []ContainerStatus `json:"containerStatuses,omitempty"`
}

Status contains fields for unmarshalling a Pod.Status

Jump to

Keyboard shortcuts

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