config

package
v1.31.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 41 Imported by: 296

Documentation

Overview

Package config implements the pod configuration readers.

Package config implements the pod configuration readers.

Index

Constants

View Source
const (
	DefaultKubeletPodsDirName                = "pods"
	DefaultKubeletVolumesDirName             = "volumes"
	DefaultKubeletVolumeSubpathsDirName      = "volume-subpaths"
	DefaultKubeletVolumeDevicesDirName       = "volumeDevices"
	DefaultKubeletPluginsDirName             = "plugins"
	DefaultKubeletPluginsRegistrationDirName = "plugins_registry"
	DefaultKubeletContainersDirName          = "containers"
	DefaultKubeletPluginContainersDirName    = "plugin-containers"
	DefaultKubeletPodResourcesDirName        = "pod-resources"
	KubeletPluginsDirSELinuxLabel            = "system_u:object_r:container_file_t:s0"
	KubeletContainersSharedSELinuxLabel      = "system_u:object_r:container_file_t:s0"
	DefaultKubeletCheckpointsDirName         = "checkpoints"
)

Defines sane defaults for the kubelet config.

View Source
const WaitForAPIServerSyncPeriod = 1 * time.Second

WaitForAPIServerSyncPeriod is the period between checks for the node list/watch initial sync

Variables

View Source
var ErrStaticPodTriedToUseClusterTrustBundle = errors.New("static pods may not use ClusterTrustBundle projected volume sources")

A static pod tried to use a ClusterTrustBundle projected volume source.

Functions

func NewSourceApiserver added in v0.9.0

func NewSourceApiserver(c clientset.Interface, nodeName types.NodeName, nodeHasSynced func() bool, updates chan<- interface{})

NewSourceApiserver creates a config source that watches and pulls from the apiserver.

func NewSourceFile

func NewSourceFile(path string, nodeName types.NodeName, period time.Duration, updates chan<- interface{})

NewSourceFile watches a config file for changes.

func NewSourceURL

func NewSourceURL(url string, header http.Header, nodeName types.NodeName, period time.Duration, updates chan<- interface{})

NewSourceURL specifies the URL where to read the Pod configuration from, then watches it for changes.

Types

type ContainerRuntimeOptions added in v1.9.0

type ContainerRuntimeOptions struct {

	// RuntimeCgroups that container runtime is expected to be isolated in.
	RuntimeCgroups string
	// PodSandboxImage is the image whose network/ipc namespaces
	// containers in each pod will use.
	PodSandboxImage string

	// ImageCredentialProviderConfigFile is the path to the credential provider plugin config file.
	// This config file is a specification for what credential providers are enabled and invoked
	// by the kubelet. The plugin config should contain information about what plugin binary
	// to execute and what container images the plugin should be called for.
	// +optional
	ImageCredentialProviderConfigFile string
	// ImageCredentialProviderBinDir is the path to the directory where credential provider plugin
	// binaries exist. The name of each plugin binary is expected to match the name of the plugin
	// specified in imageCredentialProviderConfigFile.
	// +optional
	ImageCredentialProviderBinDir string
}

ContainerRuntimeOptions defines options for the container runtime.

func (*ContainerRuntimeOptions) AddFlags added in v1.9.0

func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags to the container runtime, according to ContainerRuntimeOptions.

type PodConfig

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

PodConfig is a configuration mux that merges many sources of pod configuration into a single consistent structure, and then delivers incremental change notifications to listeners in order.

func NewPodConfig

func NewPodConfig(mode PodConfigNotificationMode, recorder record.EventRecorder, startupSLIObserver podStartupSLIObserver) *PodConfig

NewPodConfig creates an object that can merge many configuration sources into a stream of normalized updates to a pod configuration.

func (*PodConfig) Channel

func (c *PodConfig) Channel(ctx context.Context, source string) chan<- interface{}

Channel creates or returns a config source channel. The channel only accepts PodUpdates

func (*PodConfig) SeenAllSources added in v0.8.0

func (c *PodConfig) SeenAllSources(seenSources sets.Set[string]) bool

SeenAllSources returns true if seenSources contains all sources in the config, and also this config has received a SET message from each source.

func (*PodConfig) Sync

func (c *PodConfig) Sync()

Sync requests the full configuration be delivered to the update channel.

func (*PodConfig) Updates

func (c *PodConfig) Updates() <-chan kubetypes.PodUpdate

Updates returns a channel of updates to the configuration, properly denormalized.

type PodConfigNotificationMode

type PodConfigNotificationMode int

PodConfigNotificationMode describes how changes are sent to the update channel.

const (
	// PodConfigNotificationUnknown is the default value for
	// PodConfigNotificationMode when uninitialized.
	PodConfigNotificationUnknown PodConfigNotificationMode = iota
	// PodConfigNotificationSnapshot delivers the full configuration as a SET whenever
	// any change occurs.
	PodConfigNotificationSnapshot
	// PodConfigNotificationSnapshotAndUpdates delivers an UPDATE and DELETE message whenever pods are
	// changed, and a SET message if there are any additions or removals.
	PodConfigNotificationSnapshotAndUpdates
	// PodConfigNotificationIncremental delivers ADD, UPDATE, DELETE, REMOVE, RECONCILE to the update channel.
	PodConfigNotificationIncremental
)

type SourcesReady added in v1.3.0

type SourcesReady interface {
	// AddSource adds the specified source to the set of sources managed.
	AddSource(source string)
	// AllReady returns true if the currently configured sources have all been seen.
	AllReady() bool
}

SourcesReady tracks the set of configured sources seen by the kubelet.

func NewSourcesReady added in v1.3.0

func NewSourcesReady(sourcesReadyFn SourcesReadyFn) SourcesReady

NewSourcesReady returns a SourcesReady with the specified function.

type SourcesReadyFn added in v1.3.0

type SourcesReadyFn func(sourcesSeen sets.Set[string]) bool

SourcesReadyFn is function that returns true if the specified sources have been seen.

Jump to

Keyboard shortcuts

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