utils

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ProgrammedConditionTrueMessage is the message for the programmed condition when it is True.
	ProgrammedConditionTrueMessage = "Object was successfully configured in Kong."

	// ProgrammedConditionFalseInvalidMessage is the message for the programmed condition when it is False with reason Invalid.
	ProgrammedConditionFalseInvalidMessage = "Object failed to be configured in Kong - see its attached Events for more information."

	// ProgrammedConditionFalsePendingMessage is the message for the programmed condition when it is False with reason Pending.
	ProgrammedConditionFalsePendingMessage = "Object is pending configuration in Kong."
)

Variables

This section is empty.

Functions

func EnsureProgrammedCondition

func EnsureProgrammedCondition(
	configurationStatus object.ConfigurationStatus,
	objectGeneration int64,
	conditions []metav1.Condition,
	options ...ProgrammedConditionOption,
) (
	updatedConditions []metav1.Condition,
	updateNeeded bool,
)

EnsureProgrammedCondition ensures that the programmed condition is present in the conditions slice with the status reflecting the current configuration status of the object. If the condition is already present with the correct status and message, the conditions slice is returned unmodified and false is returned as the second return value. If the condition is not present, has the wrong status or a different message, the conditions slice is returned with the condition updated and true is returned. The one exception is Unknown: an existing Programmed condition is never downgraded to Unknown, so it is returned unmodified then, whatever the message difference.

func GenerateCPReferenceMatchesPredicate

func GenerateCPReferenceMatchesPredicate[T ObjectWithControlPlaneRef]() predicate.Predicate

GenerateCPReferenceMatchesPredicate generates a predicate function that filters out objects that have a control plane reference set to a value other than 'kic'.

func GeneratePredicateFuncsForIngressClassFilter

func GeneratePredicateFuncsForIngressClassFilter(name string) predicate.Funcs

GeneratePredicateFuncsForIngressClassFilter builds a controller-runtime reconciliation predicate function which filters out objects which have their ingress class set to the a value other than the controller class.

func IsDefaultIngressClass

func IsDefaultIngressClass(obj client.Object) bool

IsDefaultIngressClass returns whether an IngressClass is the default IngressClass.

func IsIngressClassEmpty

func IsIngressClassEmpty(obj client.Object) bool

IsIngressClassEmpty returns true if an object has no ingress class information or false otherwise.

func MatchesIngressClass

func MatchesIngressClass(obj client.Object, controllerIngressClass string, isDefault bool) bool

MatchesIngressClass indicates whether or not an object belongs to a given ingress class.

func UpdateLoadBalancerIngress

func UpdateLoadBalancerIngress(
	ingress client.Object,
	newAddresses []netv1.IngressLoadBalancerIngress,
) (updateNeeded bool, err error)

UpdateLoadBalancerIngress updates any supported Ingress object with new []netv1.IngressLoadBalancerIngress in a backward-compatible fashion if needed. Update does not happen in case there are no changes detected.

Types

type ObjectWithControlPlaneRef

type ObjectWithControlPlaneRef interface {
	GetControlPlaneRef() *commonv1alpha1.ControlPlaneRef
}

ObjectWithControlPlaneRef is an interface that represents an object that has a control plane reference.

type ProgrammedConditionOption

type ProgrammedConditionOption func(object.ConfigurationStatus, *metav1.Condition)

func WithFailedMessage added in v2.4.0

func WithFailedMessage(message string) ProgrammedConditionOption

WithFailedMessage sets the message of the desired Programmed condition to the given message if the configuration status is Failed. An empty message leaves the default in place.

func WithUnknownMessage

func WithUnknownMessage(message string) ProgrammedConditionOption

WithUnknownMessage sets the message of the desired Programmed condition to the given message if the configuration status is Unknown.

Jump to

Keyboard shortcuts

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