serviceprovider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceProviderConditionReady is the condition type used when reporting status
	ServiceProviderConditionReady = "Ready"
	// StatusPhaseReady indicates that the resource is ready. All conditions are met and are in status "True".
	StatusPhaseReady = "Ready"
	// StatusPhaseProgressing indicates that the resource is not ready and being created or updated.
	StatusPhaseProgressing = "Progressing"
	// StatusPhaseTerminating indicates that the resource is not ready and in deletion.
	StatusPhaseTerminating = "Terminating"
)

Variables

This section is empty.

Functions

func StatusProgressing

func StatusProgressing(obj API, reason, message string)

StatusProgressing indicates progressing with synced false

func StatusReady

func StatusReady(obj API)

StatusReady indicates ready with ready true

func StatusTerminating

func StatusTerminating(obj API)

StatusTerminating indicates terminating with synced false

Types

type API

type API interface {
	client.Object
	Status
	Finalizer() string
}

API represents the end-user facing API type

type APIReconciler

type APIReconciler[T API, C Config] struct {
	// contains filtered or unexported fields
}

APIReconciler implements a generic reconcile loop to separate platform and service provider developer space.

func (*APIReconciler[T, C]) Reconcile

func (r *APIReconciler[T, C]) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reconcileErr error)

Reconcile orchestrates platform and (domain specific) Reconciler logic to reconcile API objects

func (*APIReconciler[T, C]) SetupWithManager

func (r *APIReconciler[T, C]) SetupWithManager(mgr ctrl.Manager, name string, providerConfigUpdates chan event.GenericEvent) error

SetupWithManager sets up the controller with the Manager.

type APIReconcilerBuilder

type APIReconcilerBuilder[T API, C Config] struct {
	// contains filtered or unexported fields
}

APIReconcilerBuilder enables building valid APIReconcilers.

func NewAPIReconcilerBuilder

func NewAPIReconcilerBuilder[T API, C Config]() *APIReconcilerBuilder[T, C]

NewAPIReconcilerBuilder creates a builder.

func (*APIReconcilerBuilder[T, C]) ClusterAccessReconciler

func (b *APIReconcilerBuilder[T, C]) ClusterAccessReconciler(provider clusteraccess.Provider) *APIReconcilerBuilder[T, C]

ClusterAccessReconciler sets the cluster access reconciler.

func (*APIReconcilerBuilder[T, C]) ConfigMapNamespace added in v0.3.0

func (b *APIReconcilerBuilder[T, C]) ConfigMapNamespace(ns string) *APIReconcilerBuilder[T, C]

ConfigMapNamespace enables ConfigMap watching in the given namespace on the platform cluster. Only used if the ServiceProviderReconciler also implements ConfigMapWatcher.

func (*APIReconcilerBuilder[T, C]) EmptyObjectProvider

func (b *APIReconcilerBuilder[T, C]) EmptyObjectProvider(emptyObj func() T) *APIReconcilerBuilder[T, C]

EmptyObjectProvider sets the empty object function required for concrete type processing.

func (*APIReconcilerBuilder[T, C]) MustBuild

func (b *APIReconcilerBuilder[T, C]) MustBuild() *APIReconciler[T, C]

MustBuild validates every required field has been set and returns the APIReconciler.

func (*APIReconcilerBuilder[T, C]) OnboardingCluster

func (b *APIReconcilerBuilder[T, C]) OnboardingCluster(c *clusters.Cluster) *APIReconcilerBuilder[T, C]

OnboardingCluster set the onboarding cluster.

func (*APIReconcilerBuilder[T, C]) PlatformCluster

func (b *APIReconcilerBuilder[T, C]) PlatformCluster(c *clusters.Cluster) *APIReconcilerBuilder[T, C]

PlatformCluster sets the platform cluster.

func (*APIReconcilerBuilder[T, C]) ProviderConfig

func (b *APIReconcilerBuilder[T, C]) ProviderConfig(config C) *APIReconcilerBuilder[T, C]

ProviderConfig sets the provider config.

func (*APIReconcilerBuilder[T, C]) Reconciler

func (b *APIReconcilerBuilder[T, C]) Reconciler(reconciler Reconciler[T, C]) *APIReconcilerBuilder[T, C]

Reconciler sets the reconciler for a concrete API type.

func (*APIReconcilerBuilder[T, C]) SecretNamespace

func (b *APIReconcilerBuilder[T, C]) SecretNamespace(ns string) *APIReconcilerBuilder[T, C]

SecretNamespace enables secret watching in the given namespace on the platform cluster. Only used if the ServiceProviderReconciler also implements SecretWatcher.

func (*APIReconcilerBuilder[T, C]) WorkloadCluster

func (b *APIReconcilerBuilder[T, C]) WorkloadCluster(wlCluster bool) *APIReconcilerBuilder[T, C]

WorkloadCluster results in the service provider requesting a workload cluster

type Config

type Config interface {
	client.Object
	// PollInterval can be used to periodically requeue, preventing managed objects
	// from drifting on the target cluster.  Return 0 if not required.
	PollInterval() time.Duration
}

Config represents the config for platform operators The Config is passed to the Reconciler to reconcile API objects

type ConfigMapWatcher added in v0.3.0

type ConfigMapWatcher[PC Config] interface {
	// IsReferencedConfigMap returns true if the given ConfigMap should trigger
	// reconciliation. pc is the current provider config — it will be the
	// zero value (nil for pointer types) if not yet loaded; implementations
	// must guard against this.
	IsReferencedConfigMap(ctx context.Context, configMap *corev1.ConfigMap, pc PC) bool
}

ConfigMapWatcher can optionally be implemented by a Reconciler to trigger reconciliation of all API objects when a referenced ConfigMap in the provider namespace changes. The watch is set up on the platform cluster and filtered to the namespace configured via ConfigMapNamespace.

type ConfigReconciler

type ConfigReconciler[T Config] struct {
	// contains filtered or unexported fields
}

ConfigReconciler notifies the service provider about provider config updates through a shared update channel. Any provider config change results in a reconcile request for every existing service provider api object.

func (*ConfigReconciler[T]) Reconcile

func (b *ConfigReconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile acts as a sender to notify receivers about provider config changes.

func (*ConfigReconciler[T]) SetupWithManager

func (b *ConfigReconciler[T]) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ConfigReconcilerBuilder

type ConfigReconcilerBuilder[T Config] struct {
	// contains filtered or unexported fields
}

ConfigReconcilerBuilder enables building valid ConfigReconcilers.

func NewConfigReconcilerBuilder

func NewConfigReconcilerBuilder[T Config]() *ConfigReconcilerBuilder[T]

NewConfigReconcilerBuilder creates a builder.

func (*ConfigReconcilerBuilder[T]) EmptyObjectProvider

func (b *ConfigReconcilerBuilder[T]) EmptyObjectProvider(emptyObj func() T) *ConfigReconcilerBuilder[T]

EmptyObjectProvider sets the empty object function required for concrete type processing.

func (*ConfigReconcilerBuilder[T]) MustBuild

func (b *ConfigReconcilerBuilder[T]) MustBuild() *ConfigReconciler[T]

MustBuild validates every required field has been set and returns the ConfigReconciler.

func (*ConfigReconcilerBuilder[T]) PlatformCluster

func (b *ConfigReconcilerBuilder[T]) PlatformCluster(c *clusters.Cluster) *ConfigReconcilerBuilder[T]

PlatformCluster sets the platform cluster.

func (*ConfigReconcilerBuilder[T]) ProviderName

func (b *ConfigReconcilerBuilder[T]) ProviderName(name string) *ConfigReconcilerBuilder[T]

ProviderName sets the provider name.

func (*ConfigReconcilerBuilder[T]) UpdateChannel

func (b *ConfigReconcilerBuilder[T]) UpdateChannel(c chan event.GenericEvent) *ConfigReconcilerBuilder[T]

UpdateChannel sets the channel to send config changes.

type Reconciler

type Reconciler[T API, C Config] interface {
	// CreateOrUpdate is called on every add or update event
	CreateOrUpdate(ctx context.Context, obj T, config C, clusters clusteraccess.ClusterContext) (ctrl.Result, error)
	// Delete is called on every delete event
	Delete(ctx context.Context, obj T, config C, clusters clusteraccess.ClusterContext) (ctrl.Result, error)
}

Reconciler implements any business logic required to manage API objects

type SecretWatcher

type SecretWatcher[PC Config] interface {
	// IsReferencedSecret returns true if the given secret should trigger
	// reconciliation. pc is the current provider config — it will be the
	// zero value (nil for pointer types) if not yet loaded; implementations
	// must guard against this.
	IsReferencedSecret(ctx context.Context, secret *corev1.Secret, pc PC) bool
}

SecretWatcher can optionally be implemented by a Reconciler to trigger reconciliation of all API objects when a referenced secret in the provider namespace changes. The watch is set up on the platform cluster and filtered to the namespace configured via SecretNamespace.

type Status

type Status interface {
	// GetStatus returns the status object
	GetStatus() any
	// GetConditions returns the status object
	GetConditions() *[]metav1.Condition
	// SetPhase sets Status.Phase
	SetPhase(string)
	// SetObservedGeneration sets Status.ObservedGeneration
	SetObservedGeneration(int64)
}

Status represents the common status contract of API types

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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