ctrlutils

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRDExists

func CRDExists(client client.Client, gvr schema.GroupVersionResource) bool

CRDExists returns false if CRD does not exist

func EnsureProxyDeleteObject added in v2.1.0

func EnsureProxyDeleteObject(proxy proxy.Proxy, obj client.Object) (ctrl.Result, error)

EnsureProxyDeleteObject is a reconciliation helper to ensure that an object is removed from the backend proxy cache so that it gets removed from data-plane configurations.

func GeneratePredicateFuncsForIngressClassFilter

func GeneratePredicateFuncsForIngressClassFilter(name string, specCheckEnabled, annotationCheckEnabled bool) predicate.Funcs

GeneratePredicateFuncsForIngressClassFilter builds a controller-runtime reconciliation predicate function which filters out objects which do not have the "kubernetes.io/ingress.class" annotation configured and set to the provided value or in their .spec.

func HasAnnotation

func HasAnnotation(obj client.Object, key, expectedValue string) bool

HasAnnotation is a helper function to determine whether an object has a given annotation, and whether it's to the value provided.

func InSlice

func InSlice(e string, arr []string) bool

InSlice checks whether a string is present in a list of strings.

func IsIngressClassAnnotationConfigured

func IsIngressClassAnnotationConfigured(obj client.Object, expectedIngressClassName string) bool

IsIngressClassAnnotationConfigured determines whether an object has an ingress.class annotation configured that matches the provide IngressClassName (and is therefore an object configured to be reconciled by that class).

NOTE: keep in mind that the ingress.class annotation is deprecated and will be removed in a future release

of Kubernetes in favor of the .spec based implementation.

func IsIngressClassSpecConfigured

func IsIngressClassSpecConfigured(obj client.Object, expectedIngressClassName string) bool

IsIngressClassAnnotationConfigured determines whether an object has IngressClassName field in its spec and whether the value matches the provide IngressClassName (and is therefore an object configured to be reconciled by that class).

func MatchesIngressClassName

func MatchesIngressClassName(obj client.Object, ingressClassName string) bool

MatchesIngressClassName indicates whether or not an object indicates that it's supported by the ingress class name provided.

func SliceToStatus

func SliceToStatus(endpoints []string) []apiv1.LoadBalancerIngress

SliceToStatus converts a slice of IP and/or hostnames to LoadBalancerIngress

func UpdateIngress

func UpdateIngress(
	ctx context.Context,
	log logr.Logger,
	route *file.FRoute,
	client *clientset.Clientset,
	ips []string,
) error

UpdateIngress networking v1 ingress status

func UpdateIngressLegacy

func UpdateIngressLegacy(
	ctx context.Context,
	log logr.Logger,
	route *file.FRoute,
	client *clientset.Clientset,
	ips []string,
) error

UpdateIngressLegacy networking v1beta1 ingress status TODO: this can be removed once we no longer support old kubernetes < v1.19

func UpdateKnativeIngress

func UpdateKnativeIngress(ctx context.Context, log logr.Logger, svc file.FService, kubeCfg *rest.Config,
	ips []string, hostname string) error

UpdateKnativeIngress update knative ingress status

func UpdateStatuses

func UpdateStatuses(
	ctx context.Context,
	targetContent *file.Content,
	log logr.Logger,
	client *clientset.Clientset,
	kicClient *kicclientset.Clientset,
	wg *sync.WaitGroup,
	ips []string,
	hostname string,
	kubeConfig *rest.Config,
	kubernetesVersion semver.Version,
) error

UpdateStatuses update resources statuses according to generated rules and specs

func UpdateTCPIngress

func UpdateTCPIngress(ctx context.Context, log logr.Logger, svc file.FService, kicClient *kicclientset.Clientset,
	ips []string) error

UpdateTCPIngress TCP ingress status

func UpdateUDPIngress

func UpdateUDPIngress(ctx context.Context, log logr.Logger, svc file.FService, kicClient *kicclientset.Clientset,
	ips []string) error

UpdateUDPIngress update udp ingress status

Types

type StatusUpdater added in v2.1.0

type StatusUpdater struct {
	// contains filtered or unexported fields
}

StatusUpdater updates Kubernetes resources' status based on applied Kong configuration

func NewStatusUpdater added in v2.1.0

func NewStatusUpdater(kongConfig sendconfig.Kong, log logr.Logger, kubeConfig *rest.Config,
	publishService string, publishAddresses []string) *StatusUpdater

NewStatusUpdater returns a StatusUpdater with the provided fields

func (*StatusUpdater) NeedLeaderElection added in v2.1.0

func (s *StatusUpdater) NeedLeaderElection() bool

NeedLeaderElection indicates if the StatusUpdater must only be run by leader controllers

func (*StatusUpdater) PullConfigUpdate added in v2.1.0

func (s *StatusUpdater) PullConfigUpdate(
	ctx context.Context,
)

PullConfigUpdate is a dedicated function that process ingress/customer resource status update after configuration is updated within kong.

func (*StatusUpdater) Start added in v2.1.0

func (s *StatusUpdater) Start(ctx context.Context) error

Start starts the status update loop

Jump to

Keyboard shortcuts

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