addon

package
v1.12.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package addon holds the admission-time checks for type: addon Application components. Everything here is answerable from the Application and the cluster; resolving the addon from its registry belongs to the controller.

Index

Constants

View Source
const ComponentType = "addon"

ComponentType is the ComponentDefinition name used by the addon-as-component feature: an Application component of this type installs an addon.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator struct {
	// Client reads the addon registry ConfigMap. It comes from the manager
	// registering this webhook rather than a process-wide singleton, because
	// the webhook process never initializes that singleton: relying on it
	// means every call falls back to its lazy loader, which builds a
	// brand-new, uncached client from ambient kubeconfig state (and panics
	// outright with none).
	Client client.Client
	// contains filtered or unexported fields
}

Validator validates addon-specific Application components.

Everything it checks is answerable from the Application itself plus the registry ConfigMap. It deliberately does not resolve the addon from its registry: that is a listing plus one request per file in the package, per addon component, against a host the cluster does not control, while the apiserver holds the admission request open under admissionWebhookTimeout and failurePolicy: Fail. The addon's SystemRequirements are checked instead where the package is actually fetched, by the renderer at reconcile time, and a mismatch surfaces in the Application status.

func NewValidator

func NewValidator(cli client.Client) *Validator

NewValidator creates a Validator reading the registry records through cli.

func (*Validator) ValidateComponents

func (v *Validator) ValidateComponents(ctx context.Context, app *v1beta1.Application) field.ErrorList

ValidateComponents rejects type: addon components that cannot resolve for a reason visible locally: properties that do not decode, a registry that is not configured on this cluster, or a registry backed by Git.

Git is refused here rather than at render because the answer is in the registry ConfigMap, so admission can give it immediately and precisely, while a render-time refusal would surface as a failing Application the author has to go and read. `vela addon enable` is unaffected: this checks Application components, not the registry record, and a Git registry stays installable imperatively.

A component that names no registry is not checked for this. An empty registry means "search every configured registry", and which one wins is decided by reading each in turn over the network -- exactly what admission must not do. The renderer refuses those.

Jump to

Keyboard shortcuts

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