render

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnotationSuggestedNamespaceTemplate is a CSV annotation carrying a JSON
	// Namespace template whose metadata seeds the system-managed namespace.
	AnnotationSuggestedNamespaceTemplate = "operatorframework.io/suggested-namespace-template"
	// AnnotationSuggestedNamespace is a CSV annotation carrying the preferred
	// namespace name for the operator.
	AnnotationSuggestedNamespace = "operatorframework.io/suggested-namespace"
)

Variables

This section is empty.

Functions

func BuildNamespaceObject added in v1.12.0

func BuildNamespaceObject(name string, labels, annotations map[string]string) *corev1.Namespace

BuildNamespaceObject returns the Namespace object to include in the rendered set, seeding the given labels and annotations.

func DefaultUniqueNameGenerator

func DefaultUniqueNameGenerator(base string, o interface{}) string

Types

type BundleRenderer

type BundleRenderer struct {
	BundleValidator    BundleValidator
	ResourceGenerators []ResourceGenerator
}

func (BundleRenderer) Render

func (r BundleRenderer) Render(rv1 bundle.RegistryV1, opts ...Option) ([]client.Object, error)

type BundleValidator

type BundleValidator []func(v1 *bundle.RegistryV1) []error

BundleValidator validates a RegistryV1 bundle by executing a series of checks on it and collecting any errors that were found

func (BundleValidator) Validate

func (v BundleValidator) Validate(rv1 *bundle.RegistryV1) error

type CertSecretInfo

type CertSecretInfo struct {
	SecretName     string
	CertificateKey string
	PrivateKeyKey  string
}

CertSecretInfo contains describes the certificate secret resource information such as name and certificate and private key keys

type CertificateProvider

type CertificateProvider interface {
	InjectCABundle(obj client.Object, cfg CertificateProvisionerConfig) error
	AdditionalObjects(cfg CertificateProvisionerConfig) ([]unstructured.Unstructured, error)
	GetCertSecretInfo(cfg CertificateProvisionerConfig) CertSecretInfo
}

CertificateProvider encapsulate the creation and modification of object for certificate provisioning in Kubernetes by vendors such as CertManager or the OpenshiftServiceCA operator

type CertificateProvisioner

type CertificateProvisioner CertificateProvisionerConfig

CertificateProvisioner uses a CertificateProvider to modify and generate objects based on its CertificateProvisionerConfig

func CertProvisionerFor

func CertProvisionerFor(deploymentName string, opts Options) CertificateProvisioner

func (CertificateProvisioner) AdditionalObjects

func (c CertificateProvisioner) AdditionalObjects() ([]unstructured.Unstructured, error)

func (CertificateProvisioner) GetCertSecretInfo

func (c CertificateProvisioner) GetCertSecretInfo() *CertSecretInfo

func (CertificateProvisioner) InjectCABundle

func (c CertificateProvisioner) InjectCABundle(obj client.Object) error

type CertificateProvisionerConfig

type CertificateProvisionerConfig struct {
	ServiceName  string
	CertName     string
	Namespace    string
	CertProvider CertificateProvider
}

CertificateProvisionerConfig contains the necessary information for a CertificateProvider to correctly generate and modify object for certificate injection and automation

type Option

type Option func(*Options)

func WithCertificateProvider

func WithCertificateProvider(provider CertificateProvider) Option

func WithDeploymentConfig added in v1.8.0

func WithDeploymentConfig(deploymentConfig *config.DeploymentConfig) Option

WithDeploymentConfig sets the deployment configuration to apply to CSV deployments. If deploymentConfig is nil, no customizations are applied.

func WithSelfManagedInstallNamespace added in v1.12.0

func WithSelfManagedInstallNamespace(ns string) Option

WithSelfManagedInstallNamespace renders namespace-scoped resources into ns and treats it as a caller-managed namespace: it is assumed to already exist and no Namespace object is emitted. Without this option the renderer defaults to the bundle's system-managed namespace (resolved from CSV annotations, else "<packageName>-system") and emits a Namespace object for it.

func WithTargetNamespaces

func WithTargetNamespaces(namespaces ...string) Option

WithTargetNamespaces sets the target namespaces to be used when rendering the bundle The value will only be used if len(namespaces) > 0. Otherwise, the default value for the bundle derived from its install mode support will be used (if such a value can be defined).

func WithUniqueNameGenerator

func WithUniqueNameGenerator(generator UniqueNameGenerator) Option

type Options

type Options struct {
	InstallNamespace    string
	TargetNamespaces    []string
	UniqueNameGenerator UniqueNameGenerator
	CertificateProvider CertificateProvider
	// DeploymentConfig contains optional customizations to apply to CSV deployments.
	// If nil, no customizations are applied.
	DeploymentConfig *config.DeploymentConfig

	// SelfManagedInstallNamespace, when true, means the caller supplies InstallNamespace and
	// manages that namespace itself: it is assumed to already exist and no Namespace object is
	// rendered. When false (the default), the renderer resolves the bundle's system-managed
	// namespace and emits a Namespace object for it (see WithSelfManagedInstallNamespace).
	SelfManagedInstallNamespace bool
	// InstallNamespaceLabels and InstallNamespaceAnnotations seed metadata (e.g. PSA) on the
	// emitted Namespace object. They are defaulted from the bundle's suggested-namespace-template
	// annotation during Render setup and only consulted when SelfManagedInstallNamespace is false.
	InstallNamespaceLabels      map[string]string
	InstallNamespaceAnnotations map[string]string
}

type ResourceGenerator

type ResourceGenerator func(rv1 *bundle.RegistryV1, opts Options) ([]client.Object, error)

ResourceGenerator generates resources given a registry+v1 bundle and options

func (ResourceGenerator) GenerateResources

func (g ResourceGenerator) GenerateResources(rv1 *bundle.RegistryV1, opts Options) ([]client.Object, error)

type ResourceGenerators

type ResourceGenerators []ResourceGenerator

ResourceGenerators aggregates generators. Its GenerateResource method will call all of its generators and return generated resources.

func (ResourceGenerators) GenerateResources

func (r ResourceGenerators) GenerateResources(rv1 *bundle.RegistryV1, opts Options) ([]client.Object, error)

func (ResourceGenerators) ResourceGenerator

func (r ResourceGenerators) ResourceGenerator() ResourceGenerator

type UniqueNameGenerator

type UniqueNameGenerator func(string, interface{}) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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