kubernetesk8s.io/kubernetes/pkg/util/taints Index | Files

package taints

import "k8s.io/kubernetes/pkg/util/taints"

package taints implements utilities for working with taints

Index

Constants

const (
	MODIFIED  = "modified"
	TAINTED   = "tainted"
	UNTAINTED = "untainted"
)

Functions

func AddOrUpdateTaint

func AddOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error)

AddOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated false otherwise.

func CheckIfTaintsAlreadyExists

func CheckIfTaintsAlreadyExists(oldTaints []v1.Taint, taints []v1.Taint) string

CheckIfTaintsAlreadyExists checks if the node already has taints that we want to add and returns a string with taint keys.

func CheckTaintValidation

func CheckTaintValidation(taint v1.Taint) error

CheckTaintValidation checks if the given taint is valid. Returns error if the given taint is invalid.

func DeleteTaint

func DeleteTaint(taints []v1.Taint, taintToDelete *v1.Taint) ([]v1.Taint, bool)

DeleteTaint removes all the taints that have the same key and effect to given taintToDelete.

func DeleteTaintsByKey

func DeleteTaintsByKey(taints []v1.Taint, taintKey string) ([]v1.Taint, bool)

DeleteTaintsByKey removes all the taints that have the same key to given taintKey

func ParseTaints

func ParseTaints(spec []string) ([]v1.Taint, []v1.Taint, error)

ParseTaints takes a spec which is an array and creates slices for new taints to be added, taints to be deleted. It also validates the spec. For example, the form `<key>` may be used to remove a taint, but not to add one.

func RemoveTaint

func RemoveTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error)

RemoveTaint tries to remove a taint from annotations list. Returns a new copy of updated Node and true if something was updated false otherwise.

func TaintExists

func TaintExists(taints []v1.Taint, taintToFind *v1.Taint) bool

TaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.

func TaintKeyExists

func TaintKeyExists(taints []v1.Taint, taintKeyToMatch string) bool

TaintKeyExists checks if the given taint key exists in list of taints. Returns true if exists false otherwise.

func TaintSetDiff

func TaintSetDiff(taintsNew, taintsOld []v1.Taint) (taintsToAdd []*v1.Taint, taintsToRemove []*v1.Taint)

TaintSetDiff finds the difference between two taint slices and returns all new and removed elements of the new slice relative to the old slice. for example: input: taintsNew=[a b] taintsOld=[a c] output: taintsToAdd=[b] taintsToRemove=[c]

func TaintSetFilter

func TaintSetFilter(taints []v1.Taint, fn func(*v1.Taint) bool) []v1.Taint

TaintSetFilter filters from the taint slice according to the passed fn function to get the filtered taint slice.

Source Files

taints.go

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

Tools for package owners.