Documentation ¶
Index ¶
Constants ¶
const (
KubeletHealthPath = "/healthz"
)
Kubelet constants
Variables ¶
This section is empty.
Functions ¶
func PerformKubeletQuery ¶
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 ¶
NewKubeUtil returns a new instance of KubeUtil.
func (*KubeUtil) GetLocalPodList ¶
GetLocalPodList returns the list of pods running on the node where this pod is running
func (*KubeUtil) GetNodeInfo ¶
GetNodeInfo returns the IP address and the hostname of the node where this pod is running.
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 ¶
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