Documentation
¶
Overview ¶
Package extensions is the seam other product variants (today just Calico Enterprise) use to layer variant-specific behavior onto the core operator's render output, so core code never branches on variant.
Extensions holds one extension per controller a variant extends. Each is an interface the variant implements, covering two phases.
ExtendInputs is the controller phase. It has cluster access via controller.Inputs and does the side-effecting work a render hook can't: rejecting unsupported config, creating certificates, extending the trusted bundle.
The Modify methods are the render phase: pure hooks handed the component and the same typed config the core operator rendered it from, returning a component whose objects the variant has adjusted. Decorate does the wrapping.
A variant builds the whole set in one place at startup - see pkg/enterprise.
Index ¶
- func Decorate(base render.Component, ri render.Inputs, variant operatorv1.ProductVariant, ...) render.Component
- func DegradedReason(err error) (operatorv1.TigeraStatusReason, bool)
- func Degradedf(reason operatorv1.TigeraStatusReason, format string, args ...any) error
- func FindObject[T client.Object](objs []client.Object, name string) (T, bool)
- func InvalidConfigf(format string, args ...any) error
- func NotReadyf(format string, args ...any) error
- type APIServerExtension
- type ClusterConnectionExtension
- type Extensions
- type InstallationExtension
- type Modifier
- type Set
- type WindowsExtension
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decorate ¶
func Decorate(base render.Component, ri render.Inputs, variant operatorv1.ProductVariant, modify Modifier) render.Component
Decorate wraps base so modify runs over its rendered objects. An Installation asking for a different variant gets base untouched.
func DegradedReason ¶
func DegradedReason(err error) (operatorv1.TigeraStatusReason, bool)
DegradedReason returns the reason an extension attached to err, if it attached one.
func Degradedf ¶
func Degradedf(reason operatorv1.TigeraStatusReason, format string, args ...any) error
Degradedf returns an error the controller degrades with under the given reason.
func FindObject ¶
FindObject returns the first object of type T with the given name.
func InvalidConfigf ¶
InvalidConfigf reports configuration the variant does not support.
Types ¶
type APIServerExtension ¶
type APIServerExtension interface {
ExtendInputs(ctx context.Context, ci controller.Inputs) (controller.Inputs, []certificatemanagement.KeyPairInterface, error)
Watches(c ctrlruntime.Controller) error
// Modify layers the variant onto a component the controller rendered.
Modify(c render.Component, ri render.Inputs) render.Component
}
APIServerExtension is the variant's hook into the apiserver controller.
type ClusterConnectionExtension ¶
type ClusterConnectionExtension interface {
ExtendInputs(ctx context.Context, ci controller.Inputs) (controller.Inputs, []certificatemanagement.KeyPairInterface, error)
// ValidateAndDefault rejects fields the variant does not support and fills in
// the ones it defaults.
ValidateAndDefault(cr *operatorv1.ManagementClusterConnection) error
// Watches registers the variant's watches. The clientset is for those that must
// wait on a CRD.
Watches(c ctrlruntime.Controller, cs kubernetes.Interface) error
// Modify layers the variant onto a component the controller rendered.
Modify(c render.Component, ri render.Inputs) render.Component
}
ClusterConnectionExtension is the variant's hook into the clusterconnection controller and the guardian components it renders.
type Extensions ¶
type Extensions struct {
// contains filtered or unexported fields
}
Extensions is the variant behavior the operator runs with. The zero value extends nothing, so the accessors never return nil.
func New ¶
func New(s Set) Extensions
New returns the extensions the operator runs with. A variant builds this once at startup; see pkg/enterprise.
func (Extensions) APIServer ¶
func (e Extensions) APIServer() APIServerExtension
func (Extensions) ClusterConnection ¶
func (e Extensions) ClusterConnection() ClusterConnectionExtension
func (Extensions) Installation ¶
func (e Extensions) Installation() InstallationExtension
func (Extensions) Windows ¶
func (e Extensions) Windows() WindowsExtension
type InstallationExtension ¶
type InstallationExtension interface {
// ExtendInputs does the reconcile work render cannot, returning keypairs for the
// controller to manage. Rejects unsupported config with InvalidConfigf.
ExtendInputs(ctx context.Context, ci controller.Inputs) (controller.Inputs, []certificatemanagement.KeyPairInterface, error)
// Watches registers the watches the extension needs.
Watches(c ctrlruntime.Controller) error
// DefaultFelixConfiguration defaults FelixConfiguration fields, reporting whether
// it changed fc. It runs before Felix defaulting persists.
DefaultFelixConfiguration(install *operatorv1.InstallationSpec, fc *v3.FelixConfiguration) (bool, error)
// ProductVersion is the version the operator writes to the Installation status.
ProductVersion() string
// Images overrides the images the rendered components resolve to.
Images() *imageoverride.Overrides
// Modify layers the variant onto a component the controller rendered.
Modify(c render.Component, ri render.Inputs) render.Component
}
InstallationExtension is the variant's hook into the installation controller and the components it renders.
type Modifier ¶
Modifier post-processes the objects a render component produced. Appending to delete cleans up what a prior variant left behind.
type Set ¶
type Set struct {
Installation InstallationExtension
Windows WindowsExtension
APIServer APIServerExtension
ClusterConnection ClusterConnectionExtension
}
Set is the extensions a variant supplies, one per extended controller. What it leaves unset runs the core behavior.
type WindowsExtension ¶
type WindowsExtension interface {
ExtendInputs(ctx context.Context, ci controller.Inputs) (controller.Inputs, []certificatemanagement.KeyPairInterface, error)
Watches(c ctrlruntime.Controller) error
// Modify layers the variant onto a component the controller rendered.
Modify(c render.Component, ri render.Inputs) render.Component
Images() *imageoverride.Overrides
}
WindowsExtension is the variant's hook into the windows controller.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package extensionstest holds shared helpers for exercising an extension's Modify dispatch against raw object lists.
|
Package extensionstest holds shared helpers for exercising an extension's Modify dispatch against raw object lists. |