constraints

package
v0.0.0-...-2b9b4a5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 6

Documentation

Overview

Package constraints provides utility functions for working with constraint resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SemanticEqualWithLabelsAndAnnotations

func SemanticEqualWithLabelsAndAnnotations(c1 *unstructured.Unstructured, c2 *unstructured.Unstructured) bool

SemanticEqualWithLabelsAndAnnotations returns whether the specs of the constraints are equal. It ignores status and most metadata because neither are relevant as to how a constraint is enforced. It is assumed that the author is comparing two constraints with the same GVK/namespace/name. Labels are compared because the labels of a constraint may impact functionality (e.g. whether a constraint is expected to be enforced by Kubernetes' Validating Admission Policy). Annotations are also compared as they may be used for audit logging and export functionality, even though they do not impact enforcement.

Types

type Matcher

type Matcher interface {
	// Match returns true if the Matcher's Constraint should run against the
	// passed review object.
	// Note that this is the review object returned by HandleReview.
	Match(review interface{}) (bool, error)
}

Matcher matches object review requests.

Jump to

Keyboard shortcuts

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