kubernetesk8s.io/kubernetes/plugin/pkg/admission/podtopologylabels Index | Files

package podtopologylabels

import "k8s.io/kubernetes/plugin/pkg/admission/podtopologylabels"

Package podtopologylabels is a plugin that mutates `pod/binding` requests by copying the `topology.k8s.io/{zone,region}` labels from the assigned Node object (in the Binding being admitted) onto the Binding so that it can be persisted onto the Pod object when the Pod is being scheduled. Requests for the regular `pods` resource that set the `spec.nodeName` will also trigger the plugin to copy the labels as described. If the binding target is NOT a Node object, no action is taken. If the referenced Node object does not exist, no action is taken.

Index

Constants

const PluginName = "PodTopologyLabels"

PluginName is a string with the name of the plugin

Functions

func Register

func Register(plugins *admission.Plugins)

Register registers a plugin

Types

type Config

type Config struct {
	// Labels is set of explicit label keys to be copied from the Node object onto
	// pod Binding objects during admission.
	Labels []string
}

Config contains configuration for instances of the podtopologylabels admission plugin. This is not exposed as user-facing APIServer configuration, however can be used by platform operators when building custom topology label plugins.

type Plugin

type Plugin struct {
	*admission.Handler
	// contains filtered or unexported fields
}

func NewPodTopologyPlugin

func NewPodTopologyPlugin(c Config) *Plugin

NewPodTopologyPlugin initializes a Plugin

func (*Plugin) Admit

func (*Plugin) InspectFeatureGates

func (p *Plugin) InspectFeatureGates(featureGates featuregate.FeatureGate)

InspectFeatureGates implements WantsFeatures.

func (*Plugin) SetExternalKubeInformerFactory

func (p *Plugin) SetExternalKubeInformerFactory(factory informers.SharedInformerFactory)

func (*Plugin) ValidateInitialization

func (p *Plugin) ValidateInitialization() error

Source Files

admission.go doc.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
13 packages
Last checked
5 hours ago

Tools for package owners.