crdwatch

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 12 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

Overview

Package crdwatch watches a kind whose CRD may be missing, such as Traefik's IngressRoute: a controller can't start with a watch on a kind the API server doesn't serve, so the watch is added once it does.

Index

Constants

View Source
const DefaultInterval = 30 * time.Second

DefaultInterval is how often a missing CRD is looked for.

Variables

This section is empty.

Functions

func Installed

func Installed(mapper meta.RESTMapper, gvk schema.GroupVersionKind) (bool, error)

Installed reports whether the API server serves gvk. A missing kind is false with no error; an error means it couldn't be told.

Types

type Kind

type Kind struct {
	GVK schema.GroupVersionKind
	// Object is the type watched, as the cache holds it; nil:
	// unstructured.
	Object client.Object
	Mapper meta.RESTMapper
	Cache  cache.Cache
	// Interval between looks for the CRD; 0: DefaultInterval.
	Interval time.Duration
	// contains filtered or unexported fields
}

Kind adds watches on GVK to controllers once its CRD is installed. It is a leader-only manager runnable, like the controllers; Add every watch before the manager starts.

func (*Kind) Add

func (k *Kind) Add(c controller.Controller, h handler.EventHandler, predicates ...predicate.Predicate)

Add watches GVK for c once it is served.

func (*Kind) NeedLeaderElection

func (*Kind) NeedLeaderElection() bool

NeedLeaderElection is true: the controllers it adds watches to run on the leader.

func (*Kind) Start

func (k *Kind) Start(ctx context.Context) error

Start waits for the CRD, then starts the watches.

Jump to

Keyboard shortcuts

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