Documentation ¶
Overview ¶
Package pod tracks the current pods from the kubelet read-only port.
Index ¶
- Constants
- func CheckKubeletReadOnlyPort(ctx context.Context, port int) error
- func CreateGet(cfg Config) query.GetFunc
- func DefaultPollerReady() <-chan any
- func GetDefaultPoller() query.Poller
- func ListFromKubeletReadOnlyPort(ctx context.Context, port int) (*corev1.PodList, error)
- func New(ctx context.Context, cfg Config) components.Component
- type Config
- type ContainerStatus
- type Output
- type PodCondition
- type PodStatus
Constants ¶
View Source
const ( StateNamePod = "pod" StateKeyPodData = "data" StateKeyPodEncoding = "encoding" StateValuePodEncodingJSON = "json" )
View Source
const DefaultKubeletReadOnlyPort = 10255
View Source
const Name = "k8s-pod"
Variables ¶
This section is empty.
Functions ¶
func DefaultPollerReady ¶
func DefaultPollerReady() <-chan any
func GetDefaultPoller ¶
Types ¶
type Config ¶
type Config struct { Query query_config.Config `json:"query"` Port int `json:"port"` // In case the kubelet does not open the read-only port, we ignore such errors as // 'Get "http://localhost:10255/pods": dial tcp 127.0.0.1:10255: connect: connection refused'. IgnoreConnectionErrors bool `json:"ignore_connection_errors"` }
type ContainerStatus ¶
type ContainerStatus struct { Name string `json:"name,omitempty"` State corev1.ContainerState `json:"state,omitempty"` Ready bool `json:"ready"` RestartCount int32 `json:"restartCount"` Image string `json:"image,omitempty"` ContainerID string `json:"containerId,omitempty"` }
ref. https://pkg.go.dev/k8s.io/api/core/v1#ContainerStatus ref. https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
type Output ¶
type Output struct { NodeName string `json:"node_name,omitempty"` Pods []PodStatus `json:"pods,omitempty"` KubeletPidFound bool `json:"kubelet_pid_found"` ConnectionError string `json:"connection_error,omitempty"` Message string `json:"message,omitempty"` }
func ParseOutputJSON ¶
func ParseStatesToOutput ¶
func ParseStatesToOutput(states ...components.State) (*Output, error)
type PodCondition ¶
type PodStatus ¶
type PodStatus struct { ID string `json:"id,omitempty"` Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Phase string `json:"phase,omitempty"` Conditions []PodCondition `json:"conditions,omitempty"` Message string `json:"message,omitempty"` Reason string `json:"reason,omitempty"` StartTime *metav1.Time `json:"startTime,omitempty"` InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty"` ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"` }
PodStatus represents the simpler pod status from kubelet API. ref. https://pkg.go.dev/k8s.io/api/core/v1#PodStatus
func ConvertToPodsStatus ¶
Converts the original pod status to the simpler one.
func ParsePodStatusJSON ¶
Click to show internal directories.
Click to hide internal directories.