Help us shape the future of Go! Take the 2026 Go Developer Survey

helper

package
v1.145.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Semantic = conversion.EqualitiesOrDie(
	func(a, b resource.Quantity) bool {

		return a.Cmp(b) == 0
	},
	func(a, b metav1.MicroTime) bool {
		return a.Time.Equal(b.Time)
	},
	func(a, b metav1.Time) bool {
		return a.Time.Equal(b.Time)
	},
	func(a, b labels.Selector) bool {
		return a.String() == b.String()
	},
	func(a, b fields.Selector) bool {
		return a.String() == b.String()
	},
)

Semantic can do semantic deep equality checks for core objects. Example: apiequality.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true Copied from https://github.com/kubernetes/kubernetes/blob/v1.36.0/pkg/apis/core/helper/helpers.go#L98-L111 Changed time comparisons changed due to golangci-lint finding QF1009.

Functions

func AddOrUpdateDaemonPodTolerations

func AddOrUpdateDaemonPodTolerations(spec *corev1.PodSpec)

AddOrUpdateDaemonPodTolerations apply necessary tolerations to DaemonSet Pods, e.g. node.kubernetes.io/not-ready:NoExecute. Copied from https://github.com/kubernetes/kubernetes/blob/v1.36.0/pkg/controller/daemon/util/daemonset_util.go#L44-L87

func AddOrUpdateTolerationInPodSpec

func AddOrUpdateTolerationInPodSpec(spec *corev1.PodSpec, toleration *corev1.Toleration) bool

AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec. Returns true if something was updated, false otherwise. Copied from https://github.com/kubernetes/kubernetes/blob/v1.36.0/pkg/apis/core/v1/helper/helpers.go#L218-L237

func NodeShouldRunDaemonPod

func NodeShouldRunDaemonPod(logger klog.Logger, node *corev1.Node, ds *appsv1.DaemonSet) (bool, bool)

NodeShouldRunDaemonPod checks a set of preconditions against a (node,daemonset) and returns a summary. Returned booleans are:

  • shouldRun: Returns true when a daemonset should run on the node if a daemonset pod is not already running on that node.
  • shouldContinueRunning: Returns true when a daemonset should continue running on a node if a daemonset pod is already running on that node.

Copied from https://github.com/kubernetes/kubernetes/blob/v1.36.0/pkg/controller/daemon/daemon_controller.go#L1353-L1377 First if block semantically equally changed due to golangci-lint finding QF1001. Last argument of FindMatchingUntoleratedTaint hardcoded to false instead of utilfeature.DefaultFeatureGate.Enabled(features.TaintTolerationComparisonOperators) to avoid importing the k8s internal feature gate package. This is equivalent as the gate defaults to false (alpha since 1.35).

Types

This section is empty.

Jump to

Keyboard shortcuts

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