Documentation
¶
Overview ¶
Common types in the Kubelet.
Index ¶
- Constants
- func GetContainerName(labels map[string]string) string
- func GetPodName(labels map[string]string) string
- func GetPodNamespace(labels map[string]string) string
- func GetPodSource(pod *api.Pod) (string, error)
- func GetPodUID(labels map[string]string) string
- func GetValidatedSources(sources []string) ([]string, error)
- func IsCriticalPod(pod *api.Pod) bool
- func SortInitContainerStatuses(p *api.Pod, statuses []api.ContainerStatus)
- type HttpGetter
- type PodOperation
- type PodUpdate
- type Reservation
- type SortedContainerStatuses
- type SyncPodType
- type Timestamp
Constants ¶
const ( KubernetesPodNameLabel = "io.kubernetes.pod.name" KubernetesPodNamespaceLabel = "io.kubernetes.pod.namespace" KubernetesPodUIDLabel = "io.kubernetes.pod.uid" KubernetesContainerNameLabel = "io.kubernetes.container.name" )
const ( // This is the current pod configuration SET PodOperation = iota // Pods with the given ids are new to this source ADD // Pods with the given ids are gracefully deleted from this source DELETE // Pods with the given ids have been removed from this source REMOVE // Pods with the given ids have been updated in this source UPDATE // Pods with the given ids have unexpected status in this source, // kubelet should reconcile status with this source RECONCILE // These constants identify the sources of pods // Updates from a file FileSource = "file" // Updates from querying a web page HTTPSource = "http" // Updates from Kubernetes API Server ApiserverSource = "api" // Updates from all sources AllSource = "*" NamespaceDefault = api.NamespaceDefault )
const ConfigFirstSeenAnnotationKey = "kubernetes.io/config.seen"
const ConfigHashAnnotationKey = "kubernetes.io/config.hash"
const ConfigMirrorAnnotationKey = "kubernetes.io/config.mirror"
const ConfigSourceAnnotationKey = "kubernetes.io/config.source"
const CriticalPodAnnotationKey = "scheduler.alpha.kubernetes.io/critical-pod"
This key needs to sync with the key used by the rescheduler, which currently lives in contrib. Its presence indicates 2 things, as far as the kubelet is concerned:
- Resource related admission checks will prioritize the admission of pods bearing the key, over pods without the key, regardless of QoS.
- The OOM score of pods bearing the key will be <= pods without the key (where the <= part is determied by QoS).
const (
// system default DNS resolver configuration
ResolvConfDefault = "/etc/resolv.conf"
)
Variables ¶
This section is empty.
Functions ¶
func GetContainerName ¶ added in v1.3.0
func GetPodName ¶ added in v1.3.0
func GetPodNamespace ¶ added in v1.3.0
func GetPodSource ¶ added in v1.2.3
GetPodSource returns the source of the pod based on the annotation.
func GetValidatedSources ¶ added in v1.2.3
Gets all validated sources from the specified sources.
func IsCriticalPod ¶ added in v1.5.8
IsCriticalPod returns true if the pod bears the critical pod annotation key. Both the rescheduler and the kubelet use this key to make admission and scheduling decisions.
func SortInitContainerStatuses ¶ added in v1.3.0
func SortInitContainerStatuses(p *api.Pod, statuses []api.ContainerStatus)
SortInitContainerStatuses ensures that statuses are in the order that their init container appears in the pod spec
Types ¶
type PodOperation ¶ added in v1.2.3
type PodOperation int
PodOperation defines what changes will be made on a pod configuration.
type PodUpdate ¶ added in v1.2.3
type PodUpdate struct { Pods []*api.Pod Op PodOperation Source string }
PodUpdate defines an operation sent on the channel. You can add or remove single services by sending an array of size one and Op == ADD|REMOVE (with REMOVE, only the ID is required). For setting the state of the system to a given state for this source configuration, set Pods as desired and Op to SET, which will reset the system state to that specified in this operation for this source channel. To remove all pods, set Pods to empty object and Op to SET.
Additionally, Pods should never be nil - it should always point to an empty slice. While functionally similar, this helps our unit tests properly check that the correct PodUpdates are generated.
type Reservation ¶ added in v1.2.3
type Reservation struct { // System represents resources reserved for non-kubernetes components. System api.ResourceList // Kubernetes represents resources reserved for kubernetes system components. Kubernetes api.ResourceList }
Reservation represents reserved resources for non-pod components.
type SortedContainerStatuses ¶ added in v0.20.1
type SortedContainerStatuses []api.ContainerStatus
A type to help sort container statuses based on container names.
func (SortedContainerStatuses) Len ¶ added in v0.20.1
func (s SortedContainerStatuses) Len() int
func (SortedContainerStatuses) Less ¶ added in v0.20.1
func (s SortedContainerStatuses) Less(i, j int) bool
func (SortedContainerStatuses) Swap ¶ added in v0.20.1
func (s SortedContainerStatuses) Swap(i, j int)
type SyncPodType ¶ added in v1.2.3
type SyncPodType int
SyncPodType classifies pod updates, eg: create, update.
const ( // SyncPodSync is when the pod is synced to ensure desired state SyncPodSync SyncPodType = iota // SyncPodUpdate is when the pod is updated from source SyncPodUpdate // SyncPodCreate is when the pod is created from source SyncPodCreate // SyncPodKill is when the pod is killed based on a trigger internal to the kubelet for eviction. // If a SyncPodKill request is made to pod workers, the request is never dropped, and will always be processed. SyncPodKill )
func (SyncPodType) String ¶ added in v1.2.3
func (sp SyncPodType) String() string
type Timestamp ¶ added in v0.20.1
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp wraps around time.Time and offers utilities to format and parse the time using RFC3339Nano
func ConvertToTimestamp ¶ added in v0.20.1
ConvertToTimestamp takes a string, parses it using the RFC3339Nano layout, and converts it to a Timestamp object.
func NewTimestamp ¶ added in v0.20.1
func NewTimestamp() *Timestamp
NewTimestamp returns a Timestamp object using the current time.