Documentation
¶
Overview ¶
Package module holds the admission-time checks for type: module Application components. Everything here is answerable from the Application and the module registry ConfigMap; fetching the module from its registry belongs to the controller.
Index ¶
Constants ¶
const ComponentType = "module"
ComponentType is the ComponentDefinition name used by the module-as-component feature: an Application component of this type installs a module.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Validator ¶
type Validator struct {
// Client reads the module registry ConfigMap. It comes from the manager
// registering this webhook rather than a process-wide singleton, for the
// reason spelled out on the addon Validator: the webhook process never
// initializes that singleton.
Client client.Client
// contains filtered or unexported fields
}
Validator validates module-specific Application components.
It refuses a component that names a Git-backed registry. Modules resolve from an OCI registry only, and the source kind is in the registry ConfigMap, so admission can answer that immediately rather than leaving the author to read a failing Application later.
It deliberately does not fetch the module. That is an OCI pull against a host the cluster does not control, while the apiserver holds the admission request open under admissionWebhookTimeout and failurePolicy: Fail.
func NewValidator ¶
NewValidator creates a Validator reading registry records through cli.
func (*Validator) ValidateComponents ¶
func (v *Validator) ValidateComponents(ctx context.Context, app *v1beta1.Application) field.ErrorList
ValidateComponents rejects type: module components that cannot resolve for a reason visible locally: properties that do not decode, a namespace property, a registry that is not configured on this cluster, or a named registry that is Git backed.
A component that names no registry is not checked for its source. Resolving which registry an empty name selects is module.ResolveRegistry's policy -- the sole configured registry, or the one named "catalog" -- and duplicating that policy here is how the two would drift apart. ResolveRegistry applies it, and refuses Git, when the module is fetched.