requiredcrds

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: 4 Imported by: 0

Documentation

Overview

Package requiredcrds verifies at startup that the CRDs vela-core depends on are served by the cluster.

Distinct from cmd/core/app/hooks/crdvalidation, which asks whether a CRD's schema is new enough for the feature gates that are on. This asks whether the CRD is there at all, which has to be answered first: that hook round-trips an ApplicationRevision, and against a missing CRD it fails on a no-match error that says nothing about what is wrong.

Helm applies a chart's crds/ directory on install and never again: not on upgrade, not with --force. It is a deliberate refusal on Helm's part, since deleting a CRD takes every custom resource with it.

Helm itself fails an upgrade ("ensure CRDs are installed first") only for a kind the release manifest holds an instance of. The builtin definitions, the SourceDefinitions among them, are applied by a hook Job and are not in the manifest, so a missing CRD of a kind with no instance there passes `helm upgrade`, and it is this package that says why.

So are a CRD deleted by hand and a partial `kubectl apply` of the manifests. Six kinds are watched with For(), and a watch on a kind the API server does not serve takes the manager down with it, so one missing CRD stops Application reconciliation entirely over a feature the operator may not even use. The rest fail later and further away, on some user's Application rather than in front of whoever is doing the upgrade.

This changes neither outcome. It moves the failure to the front and gives it a cause: which CRDs are missing, and the two commands that fix it.

Index

Constants

This section is empty.

Variables

View Source
var Optional = []CRD{

	{
		Plural:           "packages",
		GroupVersionKind: schema.GroupVersionKind{Group: "cue.oam.dev", Version: "v1alpha1", Kind: "Package"},
	},
}

Optional are CRDs the chart ships whose absence vela-core survives. Listed rather than omitted so that adding a CRD to the chart forces a decision about it: TestEveryChartCRDIsClassified fails on anything in neither list.

View Source
var Required = []CRD{
	core("applications", "Application", "v1beta1"),
	core("applicationrevisions", "ApplicationRevision", "v1beta1"),
	core("resourcetrackers", "ResourceTracker", "v1beta1"),
	core("componentdefinitions", "ComponentDefinition", "v1beta1"),
	core("traitdefinitions", "TraitDefinition", "v1beta1"),
	core("policydefinitions", "PolicyDefinition", "v1beta1"),
	core("workflowstepdefinitions", "WorkflowStepDefinition", "v1beta1"),
	core("sourcedefinitions", "SourceDefinition", "v1beta1"),
	core("definitionrevisions", "DefinitionRevision", "v1beta1"),
	core("workloaddefinitions", "WorkloadDefinition", "v1beta1"),
	core("policies", "Policy", "v1alpha1"),
	core("workflows", "Workflow", "v1alpha1"),

	config("configs", "Config", "v1alpha1"),
	config("configtemplates", "ConfigTemplate", "v1alpha1"),
}

Required are the CRDs vela-core cannot run without. Each is either watched by a controller or read on the reconcile path, so its absence is not a missing feature but a broken install.

Functions

func Verify

func Verify(mapper meta.RESTMapper) error

Verify reports every required CRD the cluster does not serve.

A NoKindMatchError means the CRD is not installed. Any other error means discovery itself failed, which usually means the API server is not up yet, and reporting that as a missing CRD sends an operator down the wrong path.

Types

type CRD

type CRD struct {
	// Plural is the resource name, matching the CRD's spec.names.plural.
	Plural string
	// GroupVersionKind identifies the kind to look up.
	schema.GroupVersionKind
}

CRD is one custom resource definition vela-core expects to find.

func (CRD) Name

func (c CRD) Name() string

Name is the CRD's own name, <plural>.<group>, which is what kubectl prints and what an operator will search for.

Jump to

Keyboard shortcuts

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