staticpod

package
v1.35.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 27 Imported by: 110

Documentation

Overview

Package staticpod contains utilities for managing the static pod.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComponentPod

func ComponentPod(container v1.Container, volumes map[string]v1.Volume, annotations map[string]string) v1.Pod

ComponentPod returns a Pod object from the container, volume and annotations specifications

func ComponentResources

func ComponentResources(cpu string) v1.ResourceRequirements

ComponentResources returns the v1.ResourceRequirements object needed for allocating a specified amount of the CPU

func DeepHashObject added in v1.24.15

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes. Copied from k8s.io/kubernetes/pkg/util/hash/hash.go#DeepHashObject

func GetAPIServerProbeAddress added in v1.14.0

func GetAPIServerProbeAddress(endpoint *kubeadmapi.APIEndpoint) string

GetAPIServerProbeAddress returns the probe address for the API server

func GetControllerManagerProbeAddress added in v1.14.0

func GetControllerManagerProbeAddress(cfg *kubeadmapi.ClusterConfiguration) string

GetControllerManagerProbeAddress returns the kubernetes controller manager probe address

func GetEtcdProbeEndpoint added in v1.16.0

func GetEtcdProbeEndpoint(cfg *kubeadmapi.Etcd, isIPv6 bool) (string, int32, v1.URIScheme)

GetEtcdProbeEndpoint takes a kubeadm Etcd configuration object and attempts to parse the first URL in the listen-metrics-urls argument, returning an etcd probe hostname, port and scheme

func GetSchedulerProbeAddress added in v1.14.0

func GetSchedulerProbeAddress(cfg *kubeadmapi.ClusterConfiguration) string

GetSchedulerProbeAddress returns the kubernetes scheduler probe address

func GetUsersAndGroups added in v1.22.0

func GetUsersAndGroups() (*users.UsersAndGroups, error)

GetUsersAndGroups returns the local usersAndGroups, but first creates it in a thread safe way once.

func IsControlPlaneNode added in v1.32.10

func IsControlPlaneNode() bool

IsControlPlaneNode returns true if the kube-apiserver static pod manifest is present on the host.

func LivenessProbe added in v1.16.0

func LivenessProbe(host, path, port string, scheme v1.URIScheme) *v1.Probe

LivenessProbe creates a Probe object with a HTTPGet handler

func ManifestFilesAreEqual added in v1.13.0

func ManifestFilesAreEqual(path1, path2 string) (bool, string, error)

ManifestFilesAreEqual compares 2 files. It returns true if their contents are equal, false otherwise

func NewVolume

func NewVolume(name, path string, pathType *v1.HostPathType) v1.Volume

NewVolume creates a v1.Volume with a hostPath mount to the specified location

func NewVolumeMount

func NewVolumeMount(name, path string, readOnly bool) v1.VolumeMount

NewVolumeMount creates a v1.VolumeMount to the specified location

func PatchStaticPod added in v1.19.0

func PatchStaticPod(pod *v1.Pod, patchesDir string, output io.Writer) (*v1.Pod, error)

PatchStaticPod applies patches stored in patchesDir to a static Pod.

func ReadMultipleStaticPodsFromDisk added in v1.33.0

func ReadMultipleStaticPodsFromDisk(manifestDir string, components ...string) (map[string]*v1.Pod, error)

ReadMultipleStaticPodsFromDisk reads multiple known component static Pods from manifestDir and returns a list of Pods objects.

func ReadStaticPodFromDisk added in v1.10.2

func ReadStaticPodFromDisk(manifestPath string) (*v1.Pod, error)

ReadStaticPodFromDisk reads a static pod file from disk

func ReadinessProbe added in v1.19.0

func ReadinessProbe(host, path, port string, scheme v1.URIScheme) *v1.Probe

ReadinessProbe creates a Probe object with a HTTPGet handler

func RunComponentAsNonRoot added in v1.22.0

func RunComponentAsNonRoot(componentName string, pod *v1.Pod, usersAndGroups *users.UsersAndGroups, cfg *kubeadmapi.ClusterConfiguration) error

RunComponentAsNonRoot updates the pod manifest and the hostVolume permissions to run as non root.

func StartupProbe added in v1.19.0

func StartupProbe(host, path, port string, scheme v1.URIScheme, timeoutForControlPlane *metav1.Duration) *v1.Probe

StartupProbe creates a Probe object with a HTTPGet handler

func VolumeMapToSlice added in v1.9.0

func VolumeMapToSlice(volumes map[string]v1.Volume) []v1.Volume

VolumeMapToSlice returns a slice of volumes from a map's values

func VolumeMountMapToSlice added in v1.9.0

func VolumeMountMapToSlice(volumeMounts map[string]v1.VolumeMount) []v1.VolumeMount

VolumeMountMapToSlice returns a slice of volumes from a map's values

func WriteStaticPodToDisk

func WriteStaticPodToDisk(componentName, manifestDir string, pod v1.Pod) error

WriteStaticPodToDisk writes a static pod file to disk

Types

This section is empty.

Jump to

Keyboard shortcuts

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