revision

package
v1.16.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Overview

Package revision implements the Crossplane Package Revision controllers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPackageOwnerReference added in v1.5.0

func GetPackageOwnerReference(rev resource.Object) (metav1.OwnerReference, bool)

GetPackageOwnerReference returns the owner reference that points to the owner package of given revision, if it can find one.

func PackageRevision

func PackageRevision(pr v1.PackageRevision) parser.BackendOption

PackageRevision sets the package revision for ImageBackend.

func SetupConfigurationRevision

func SetupConfigurationRevision(mgr ctrl.Manager, o controller.Options) error

SetupConfigurationRevision adds a controller that reconciles ConfigurationRevisions.

func SetupFunctionRevision added in v1.14.0

func SetupFunctionRevision(mgr ctrl.Manager, o controller.Options) error

SetupFunctionRevision adds a controller that reconciles FunctionRevisions.

func SetupProviderRevision

func SetupProviderRevision(mgr ctrl.Manager, o controller.Options) error

SetupProviderRevision adds a controller that reconciles ProviderRevisions.

Types

type APIEstablisher

type APIEstablisher struct {
	// contains filtered or unexported fields
}

APIEstablisher establishes control or ownership of resources in the API server for a parent.

func NewAPIEstablisher

func NewAPIEstablisher(client client.Client, namespace string) *APIEstablisher

NewAPIEstablisher creates a new APIEstablisher.

func (*APIEstablisher) Establish

func (e *APIEstablisher) Establish(ctx context.Context, objs []runtime.Object, parent v1.PackageRevision, control bool) ([]xpv1.TypedReference, error)

Establish checks that control or ownership of resources can be established by parent, then establishes it.

func (*APIEstablisher) ReleaseObjects added in v1.14.0

func (e *APIEstablisher) ReleaseObjects(ctx context.Context, parent v1.PackageRevision) error

ReleaseObjects removes control of owned resources in the API server for a package revision.

type DependencyManager

type DependencyManager interface {
	Resolve(ctx context.Context, pkg runtime.Object, pr v1.PackageRevision) (found, installed, invalid int, err error)
	RemoveSelf(ctx context.Context, pr v1.PackageRevision) error
}

DependencyManager is a lock on packages.

type DeploymentOverride added in v1.14.0

type DeploymentOverride func(deployment *appsv1.Deployment)

DeploymentOverride is a modifier option that overrides a Deployment.

func DeploymentForControllerConfig added in v1.14.0

func DeploymentForControllerConfig(cc *v1alpha1.ControllerConfig) DeploymentOverride

DeploymentForControllerConfig overrides the deployment with the values defined in the ControllerConfig.

func DeploymentRuntimeWithAdditionalEnvironments added in v1.14.0

func DeploymentRuntimeWithAdditionalEnvironments(env []corev1.EnvVar) DeploymentOverride

DeploymentRuntimeWithAdditionalEnvironments adds additional environment variables to the runtime container of a Deployment.

func DeploymentRuntimeWithAdditionalPorts added in v1.14.0

func DeploymentRuntimeWithAdditionalPorts(ports []corev1.ContainerPort) DeploymentOverride

DeploymentRuntimeWithAdditionalPorts adds additional ports to the runtime container of a Deployment.

func DeploymentRuntimeWithImagePullPolicy added in v1.14.0

func DeploymentRuntimeWithImagePullPolicy(policy corev1.PullPolicy) DeploymentOverride

DeploymentRuntimeWithImagePullPolicy overrides the image pull policy of the runtime container of a Deployment.

func DeploymentRuntimeWithOptionalImage added in v1.14.0

func DeploymentRuntimeWithOptionalImage(image string) DeploymentOverride

DeploymentRuntimeWithOptionalImage set the image for the runtime container if it is unset, e.g. not specified in the DeploymentRuntimeConfig. Note that if the image was already set, we use it exactly as is (i.e., no default registry).

func DeploymentRuntimeWithOptionalImagePullPolicy added in v1.14.0

func DeploymentRuntimeWithOptionalImagePullPolicy(policy corev1.PullPolicy) DeploymentOverride

DeploymentRuntimeWithOptionalImagePullPolicy set the image pull policy if it is unset.

func DeploymentRuntimeWithOptionalSecurityContext added in v1.14.0

func DeploymentRuntimeWithOptionalSecurityContext(securityContext *corev1.SecurityContext) DeploymentOverride

DeploymentRuntimeWithOptionalSecurityContext sets the security context of the runtime container if it is unset.

func DeploymentRuntimeWithTLSClientSecret added in v1.14.0

func DeploymentRuntimeWithTLSClientSecret(secret string) DeploymentOverride

DeploymentRuntimeWithTLSClientSecret mounts a TLS Client secret as a volume and sets the path of the mounted volume as an environment variable of the runtime container of a Deployment.

func DeploymentRuntimeWithTLSServerSecret added in v1.14.0

func DeploymentRuntimeWithTLSServerSecret(secret string) DeploymentOverride

DeploymentRuntimeWithTLSServerSecret mounts a TLS Server secret as a volume and sets the path of the mounted volume as an environment variable of the runtime container of a Deployment.

func DeploymentWithImagePullSecrets added in v1.14.0

func DeploymentWithImagePullSecrets(secrets []corev1.LocalObjectReference) DeploymentOverride

DeploymentWithImagePullSecrets overrides the image pull secrets of a Deployment.

func DeploymentWithNamespace added in v1.14.0

func DeploymentWithNamespace(namespace string) DeploymentOverride

DeploymentWithNamespace overrides the namespace of a Deployment.

func DeploymentWithOptionalName added in v1.14.0

func DeploymentWithOptionalName(name string) DeploymentOverride

DeploymentWithOptionalName overrides the name of a Deployment if empty.

func DeploymentWithOptionalPodScrapeAnnotations added in v1.14.8

func DeploymentWithOptionalPodScrapeAnnotations() DeploymentOverride

DeploymentWithOptionalPodScrapeAnnotations adds Prometheus scrape annotations to a Deployment pod template if they are not already set.

func DeploymentWithOptionalPodSecurityContext added in v1.14.0

func DeploymentWithOptionalPodSecurityContext(podSecurityContext *corev1.PodSecurityContext) DeploymentOverride

DeploymentWithOptionalPodSecurityContext sets the pod security context if it is unset.

func DeploymentWithOptionalReplicas added in v1.14.0

func DeploymentWithOptionalReplicas(replicas int32) DeploymentOverride

DeploymentWithOptionalReplicas set the replicas if it is unset.

func DeploymentWithOptionalServiceAccount added in v1.14.0

func DeploymentWithOptionalServiceAccount(sa string) DeploymentOverride

DeploymentWithOptionalServiceAccount overrides the service account of a Deployment.

func DeploymentWithOwnerReferences added in v1.14.0

func DeploymentWithOwnerReferences(owners []metav1.OwnerReference) DeploymentOverride

DeploymentWithOwnerReferences overrides the owner references of a Deployment.

func DeploymentWithRuntimeContainer added in v1.14.0

func DeploymentWithRuntimeContainer() DeploymentOverride

DeploymentWithRuntimeContainer ensures that the runtime container exists and is the first container.

func DeploymentWithSelectors added in v1.14.0

func DeploymentWithSelectors(selectors map[string]string) DeploymentOverride

DeploymentWithSelectors overrides the selectors of a Deployment. It also ensures that the pod template labels always contains the deployment selector.

type EnqueueRequestForReferencingFunctionRevisions added in v1.14.0

type EnqueueRequestForReferencingFunctionRevisions struct {
	// contains filtered or unexported fields
}

EnqueueRequestForReferencingFunctionRevisions enqueues a request for all function revisions that reference a ControllerConfig when the given ControllerConfig changes.

func (*EnqueueRequestForReferencingFunctionRevisions) Create added in v1.14.0

Create enqueues a request for all function revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingFunctionRevisions) Delete added in v1.14.0

Delete enqueues a request for all function revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingFunctionRevisions) Generic added in v1.14.0

Generic enqueues a request for all function revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingFunctionRevisions) Update added in v1.14.0

Update enqueues a request for all function revisions that reference a given ControllerConfig.

type EnqueueRequestForReferencingProviderRevisions added in v1.1.4

type EnqueueRequestForReferencingProviderRevisions struct {
	// contains filtered or unexported fields
}

EnqueueRequestForReferencingProviderRevisions enqueues a request for all provider revisions that reference a ControllerConfig when the given ControllerConfig changes.

func (*EnqueueRequestForReferencingProviderRevisions) Create added in v1.1.4

Create enqueues a request for all provider revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingProviderRevisions) Delete added in v1.1.4

Delete enqueues a request for all provider revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingProviderRevisions) Generic added in v1.1.4

Generic enqueues a request for all provider revisions that reference a given ControllerConfig.

func (*EnqueueRequestForReferencingProviderRevisions) Update added in v1.1.4

Update enqueues a request for all provider revisions that reference a given ControllerConfig.

type Establisher

type Establisher interface {
	Establish(ctx context.Context, objects []runtime.Object, parent v1.PackageRevision, control bool) ([]xpv1.TypedReference, error)
	ReleaseObjects(ctx context.Context, parent v1.PackageRevision) error
}

An Establisher establishes control or ownership of a set of resources in the API server by checking that control or ownership can be established for all resources and then establishing it.

type FunctionHooks added in v1.14.0

type FunctionHooks struct {
	// contains filtered or unexported fields
}

FunctionHooks performs runtime operations for function packages.

func NewFunctionHooks added in v1.14.0

func NewFunctionHooks(client client.Client, defaultRegistry string) *FunctionHooks

NewFunctionHooks returns a new FunctionHooks.

func (*FunctionHooks) Deactivate added in v1.14.0

Deactivate performs operations meant to happen before deactivating a revision.

func (*FunctionHooks) Post added in v1.14.0

Post performs operations meant to happen after establishing objects.

func (*FunctionHooks) Pre added in v1.14.0

Pre performs operations meant to happen before establishing objects.

type ImageBackend

type ImageBackend struct {
	// contains filtered or unexported fields
}

ImageBackend is a backend for parser.

func NewImageBackend

func NewImageBackend(fetcher xpkg.Fetcher, opts ...ImageBackendOption) *ImageBackend

NewImageBackend creates a new image backend.

func (*ImageBackend) Init

Init initializes an ImageBackend.

type ImageBackendOption added in v1.4.0

type ImageBackendOption func(i *ImageBackend)

An ImageBackendOption sets configuration for an image backend.

func WithDefaultRegistry added in v1.4.0

func WithDefaultRegistry(registry string) ImageBackendOption

WithDefaultRegistry sets the default registry that an image backend will use.

type ManifestBuilder added in v1.14.0

type ManifestBuilder interface {
	// ServiceAccount builds and returns the service account manifest.
	ServiceAccount(overrides ...ServiceAccountOverride) *corev1.ServiceAccount
	// Deployment builds and returns the deployment manifest.
	Deployment(serviceAccount string, overrides ...DeploymentOverride) *appsv1.Deployment
	// Service builds and returns the service manifest.
	Service(overrides ...ServiceOverride) *corev1.Service
	// TLSClientSecret builds and returns the TLS client secret manifest.
	TLSClientSecret() *corev1.Secret
	// TLSServerSecret builds and returns the TLS server secret manifest.
	TLSServerSecret() *corev1.Secret
}

ManifestBuilder builds the runtime manifests for a package revision.

type NopEstablisher added in v1.7.0

type NopEstablisher struct{}

NopEstablisher does nothing.

func NewNopEstablisher added in v1.7.0

func NewNopEstablisher() *NopEstablisher

NewNopEstablisher returns a new NopEstablisher.

func (*NopEstablisher) Establish added in v1.7.0

Establish does nothing.

func (*NopEstablisher) ReleaseObjects added in v1.14.0

func (*NopEstablisher) ReleaseObjects(_ context.Context, _ v1.PackageRevision) error

ReleaseObjects does nothing.

type PackageDependencyManager

type PackageDependencyManager struct {
	// contains filtered or unexported fields
}

PackageDependencyManager is a resolver for packages.

func NewPackageDependencyManager

func NewPackageDependencyManager(c client.Client, nd dag.NewDAGFn, t v1beta1.PackageType) *PackageDependencyManager

NewPackageDependencyManager creates a new PackageDependencyManager.

func (*PackageDependencyManager) RemoveSelf

RemoveSelf removes a package from the lock.

func (*PackageDependencyManager) Resolve

func (m *PackageDependencyManager) Resolve(ctx context.Context, pkg runtime.Object, pr v1.PackageRevision) (found, installed, invalid int, err error)

Resolve resolves package dependencies.

type ProviderHooks

type ProviderHooks struct {
	// contains filtered or unexported fields
}

ProviderHooks performs runtime operations for provider packages.

func NewProviderHooks

func NewProviderHooks(client client.Client, defaultRegistry string) *ProviderHooks

NewProviderHooks returns a new ProviderHooks.

func (*ProviderHooks) Deactivate added in v1.14.0

Deactivate performs operations meant to happen before deactivating a revision.

func (*ProviderHooks) Post

Post performs operations meant to happen after establishing objects.

func (*ProviderHooks) Pre

Pre performs operations meant to happen before establishing objects.

type Reconciler

type Reconciler struct {
	// contains filtered or unexported fields
}

Reconciler reconciles packages.

func NewReconciler

func NewReconciler(mgr manager.Manager, opts ...ReconcilerOption) *Reconciler

NewReconciler creates a new package revision reconciler.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

Reconcile package revision.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

ReconcilerOption is used to configure the Reconciler.

func WithCache

func WithCache(c xpkg.PackageCache) ReconcilerOption

WithCache specifies how the Reconcile should cache package contents.

func WithClientApplicator

func WithClientApplicator(ca resource.ClientApplicator) ReconcilerOption

WithClientApplicator specifies how the Reconciler should interact with the Kubernetes API.

func WithDependencyManager

func WithDependencyManager(m DependencyManager) ReconcilerOption

WithDependencyManager specifies how the Reconciler should manage dependencies.

func WithEstablisher

func WithEstablisher(e Establisher) ReconcilerOption

WithEstablisher specifies how the Reconciler should establish package resources.

func WithFeatureFlags added in v1.14.0

func WithFeatureFlags(f *feature.Flags) ReconcilerOption

WithFeatureFlags specifies the feature flags to inject into the Reconciler.

func WithFinalizer

func WithFinalizer(f resource.Finalizer) ReconcilerOption

WithFinalizer specifies how the Reconciler should finalize package revisions.

func WithLinter

func WithLinter(l parser.Linter) ReconcilerOption

WithLinter specifies how the Reconciler should lint a package.

func WithLogger

func WithLogger(log logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithNamespace added in v1.14.0

func WithNamespace(n string) ReconcilerOption

WithNamespace specifies the namespace in which the Reconciler should create runtime resources.

func WithNewPackageRevisionFn

func WithNewPackageRevisionFn(f func() v1.PackageRevision) ReconcilerOption

WithNewPackageRevisionFn determines the type of package being reconciled.

func WithParser

func WithParser(p parser.Parser) ReconcilerOption

WithParser specifies how the Reconciler should parse a package.

func WithParserBackend

func WithParserBackend(p parser.Backend) ReconcilerOption

WithParserBackend specifies how the Reconciler should parse a package.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record Kubernetes events.

func WithRuntimeHooks added in v1.14.0

func WithRuntimeHooks(h RuntimeHooks) ReconcilerOption

WithRuntimeHooks specifies how the Reconciler should perform preparations (pre- and post-establishment) and cleanup (deactivate) for package runtime. The hooks are only used when the package has a runtime and the runtime is configured as Deployment.

func WithServiceAccount added in v1.14.0

func WithServiceAccount(sa string) ReconcilerOption

WithServiceAccount specifies the core Crossplane ServiceAccount name.

func WithVersioner

func WithVersioner(v version.Operations) ReconcilerOption

WithVersioner specifies how the Reconciler should fetch the current Crossplane version.

type RuntimeHooks added in v1.14.0

type RuntimeHooks interface {
	// Pre performs operations meant to happen before establishing objects.
	Pre(ctx context.Context, obj runtime.Object, pr v1.PackageRevisionWithRuntime, b ManifestBuilder) error

	// Post performs operations meant to happen after establishing objects.
	Post(ctx context.Context, obj runtime.Object, pr v1.PackageRevisionWithRuntime, b ManifestBuilder) error

	// Deactivate performs operations meant to happen before deactivating a revision.
	Deactivate(ctx context.Context, pr v1.PackageRevisionWithRuntime, b ManifestBuilder) error
}

A RuntimeHooks performs runtime operations before and after a revision establishes objects.

type RuntimeManifestBuilder added in v1.14.0

type RuntimeManifestBuilder struct {
	// contains filtered or unexported fields
}

RuntimeManifestBuilder builds the runtime manifests for a package revision.

func NewRuntimeManifestBuilder added in v1.14.0

func NewRuntimeManifestBuilder(pwr v1.PackageRevisionWithRuntime, namespace string, opts ...RuntimeManifestBuilderOption) *RuntimeManifestBuilder

NewRuntimeManifestBuilder returns a new RuntimeManifestBuilder.

func (*RuntimeManifestBuilder) Deployment added in v1.14.0

func (b *RuntimeManifestBuilder) Deployment(serviceAccount string, overrides ...DeploymentOverride) *appsv1.Deployment

Deployment builds and returns the Deployment manifest.

func (*RuntimeManifestBuilder) Service added in v1.14.0

func (b *RuntimeManifestBuilder) Service(overrides ...ServiceOverride) *corev1.Service

Service builds and returns the Service manifest.

func (*RuntimeManifestBuilder) ServiceAccount added in v1.14.0

func (b *RuntimeManifestBuilder) ServiceAccount(overrides ...ServiceAccountOverride) *corev1.ServiceAccount

ServiceAccount builds and returns the ServiceAccount manifest.

func (*RuntimeManifestBuilder) TLSClientSecret added in v1.14.0

func (b *RuntimeManifestBuilder) TLSClientSecret() *corev1.Secret

TLSClientSecret builds and returns the Secret manifest for the TLS client certificate.

func (*RuntimeManifestBuilder) TLSServerSecret added in v1.14.0

func (b *RuntimeManifestBuilder) TLSServerSecret() *corev1.Secret

TLSServerSecret builds and returns the Secret manifest for the TLS server certificate.

type RuntimeManifestBuilderOption added in v1.14.0

type RuntimeManifestBuilderOption func(*RuntimeManifestBuilder)

RuntimeManifestBuilderOption is used to configure a RuntimeManifestBuilder.

func RuntimeManifestBuilderWithControllerConfig added in v1.14.0

func RuntimeManifestBuilderWithControllerConfig(cc *v1alpha1.ControllerConfig) RuntimeManifestBuilderOption

RuntimeManifestBuilderWithControllerConfig sets the controller config to use when building the runtime manifests.

func RuntimeManifestBuilderWithRuntimeConfig added in v1.14.0

func RuntimeManifestBuilderWithRuntimeConfig(rc *v1beta1.DeploymentRuntimeConfig) RuntimeManifestBuilderOption

RuntimeManifestBuilderWithRuntimeConfig sets the deployment runtime config to use when building the runtime manifests.

func RuntimeManifestBuilderWithServiceAccountPullSecrets added in v1.14.0

func RuntimeManifestBuilderWithServiceAccountPullSecrets(secrets []corev1.LocalObjectReference) RuntimeManifestBuilderOption

RuntimeManifestBuilderWithServiceAccountPullSecrets sets the service account pull secrets to use when building the runtime manifests.

type ServiceAccountOverride added in v1.14.0

type ServiceAccountOverride func(sa *corev1.ServiceAccount)

ServiceAccountOverride is a modifier option that overrides a ServiceAccount.

func ServiceAccountWithAdditionalPullSecrets added in v1.14.0

func ServiceAccountWithAdditionalPullSecrets(secrets []corev1.LocalObjectReference) ServiceAccountOverride

ServiceAccountWithAdditionalPullSecrets adds additional image pull secrets to a ServiceAccount.

func ServiceAccountWithControllerConfig added in v1.14.0

func ServiceAccountWithControllerConfig(cc *v1alpha1.ControllerConfig) ServiceAccountOverride

ServiceAccountWithControllerConfig overrides the labels, annotations and name of a ServiceAccount with the values defined in the ControllerConfig.

func ServiceAccountWithNamespace added in v1.14.0

func ServiceAccountWithNamespace(namespace string) ServiceAccountOverride

ServiceAccountWithNamespace overrides the namespace of a ServiceAccount.

func ServiceAccountWithOptionalName added in v1.14.0

func ServiceAccountWithOptionalName(name string) ServiceAccountOverride

ServiceAccountWithOptionalName overrides the name of a ServiceAccount if empty.

func ServiceAccountWithOwnerReferences added in v1.14.0

func ServiceAccountWithOwnerReferences(owners []metav1.OwnerReference) ServiceAccountOverride

ServiceAccountWithOwnerReferences overrides the owner references of a ServiceAccount.

type ServiceOverride added in v1.14.0

type ServiceOverride func(service *corev1.Service)

ServiceOverride is a modifier option that overrides a Service.

func ServiceWithAdditionalPorts added in v1.14.0

func ServiceWithAdditionalPorts(ports []corev1.ServicePort) ServiceOverride

ServiceWithAdditionalPorts adds additional ports to a Service.

func ServiceWithClusterIP added in v1.14.0

func ServiceWithClusterIP(clusterIP string) ServiceOverride

ServiceWithClusterIP overrides the cluster IP of a Service.

func ServiceWithName added in v1.14.0

func ServiceWithName(name string) ServiceOverride

ServiceWithName overrides the name of a Service.

func ServiceWithNamespace added in v1.14.0

func ServiceWithNamespace(namespace string) ServiceOverride

ServiceWithNamespace overrides the namespace of a Service.

func ServiceWithOptionalName added in v1.14.0

func ServiceWithOptionalName(name string) ServiceOverride

ServiceWithOptionalName overrides the name of a Service if empty.

func ServiceWithOwnerReferences added in v1.14.0

func ServiceWithOwnerReferences(owners []metav1.OwnerReference) ServiceOverride

ServiceWithOwnerReferences overrides the owner references of a Service.

func ServiceWithSelectors added in v1.14.0

func ServiceWithSelectors(selectors map[string]string) ServiceOverride

ServiceWithSelectors overrides the selectors of a Service.

Jump to

Keyboard shortcuts

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