runtime

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 21 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"
)

TODO: Move status fuctions and constants to separate repository

Variables

This section is empty.

Functions

func StatusFailed

func StatusFailed(obj ServiceProviderAPI, msg string)

StatusFailed indicates ready with ready true

func StatusProgressing

func StatusProgressing(obj ServiceProviderAPI, reason string, message string)

StatusProgressing indicates progressing with synced false

func StatusReady

func StatusReady(obj ServiceProviderAPI)

StatusReady indicates ready with ready true

func StatusTerminating

func StatusTerminating(obj ServiceProviderAPI)

StatusTerminating indicates terminating with synced false

Types

type ClusterContext

type ClusterContext struct {
	// MCPCluster is the managed control plane that belongs to the current reconcile request
	MCPCluster *clusters.Cluster
	// WorkloadCluster is the workload cluster that belongs the current reconcile request
	WorkloadCluster *clusters.Cluster
}

ClusterContext provides access to request-scoped clusters. These clusters include the managed control plane and workload clusters associated with a specific reconcile request. (Static clusters like the platform and onboarding clusters are provided to the reconciler when it is initialized.)

More info on the deployment model: https://openmcp-project.github.io/docs/about/design/service-provider#deployment-model

type PCReconciler

type PCReconciler[T ProviderConfig] struct {
	// contains filtered or unexported fields
}

PCReconciler 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 NewPCReconciler

func NewPCReconciler[T ProviderConfig](providerName string, emptyObj func() T) *PCReconciler[T]

NewPCReconciler creates a new provider PCReconciler instance.

func (*PCReconciler[T]) Reconcile

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

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

func (*PCReconciler[T]) SetupWithManager

func (r *PCReconciler[T]) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*PCReconciler[T]) WithPlatformCluster

func (r *PCReconciler[T]) WithPlatformCluster(c *clusters.Cluster) *PCReconciler[T]

WithPlatformCluster sets the platform cluster.

func (*PCReconciler[T]) WithUpdateChannel

func (r *PCReconciler[T]) WithUpdateChannel(c chan event.GenericEvent) *PCReconciler[T]

WithUpdateChannel sets the channel to send config changes.

type ProviderConfig

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

ProviderConfig represents the config for platform operators The ProviderConfig is passed to the DomainServiceReconcile to reconcile APIObjects

type SPReconciler

type SPReconciler[T ServiceProviderAPI, PC ProviderConfig] struct {
	// contains filtered or unexported fields
}

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

func NewSPReconciler

func NewSPReconciler[T ServiceProviderAPI, PC ProviderConfig](emptyObj func() T) *SPReconciler[T, PC]

NewSPReconciler creates a reconciler instance for the given types.

func (*SPReconciler[T, PC]) Reconcile

func (r *SPReconciler[T, PC]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile orchestrates platform and DomainServiceReconciler logic to reconcile APIObjects

func (*SPReconciler[T, PC]) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*SPReconciler[T, PC]) WithClusterAccessReconciler

func (r *SPReconciler[T, PC]) WithClusterAccessReconciler(car clusteraccess.Reconciler) *SPReconciler[T, PC]

WithClusterAccessReconciler sets the cluster access reconciler.

func (*SPReconciler[T, PC]) WithOnboardingCluster

func (r *SPReconciler[T, PC]) WithOnboardingCluster(c *clusters.Cluster) *SPReconciler[T, PC]

WithOnboardingCluster set the onboarding cluster.

func (*SPReconciler[T, PC]) WithPlatformCluster

func (r *SPReconciler[T, PC]) WithPlatformCluster(c *clusters.Cluster) *SPReconciler[T, PC]

WithPlatformCluster set the platform cluster.

func (*SPReconciler[T, PC]) WithServiceProviderReconciler

func (r *SPReconciler[T, PC]) WithServiceProviderReconciler(dsr ServiceProviderReconciler[T, PC]) *SPReconciler[T, PC]

WithServiceProviderReconciler sets the service provider reconciler.

func (*SPReconciler[T, PC]) WithWorkloadCluster

func (r *SPReconciler[T, PC]) WithWorkloadCluster(b bool) *SPReconciler[T, PC]

WithWorkloadCluster sets if the service provider reconciler requests a workload cluster

type ServiceProviderAPI

type ServiceProviderAPI interface {
	client.Object
	ServiceProviderAPIStatus
	Finalizer() string
}

ServiceProviderAPI represents the end-user facing onboarding api type

type ServiceProviderAPIStatus

type ServiceProviderAPIStatus 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)
}

ServiceProviderAPIStatus represents the common status contract of ServiceProviderAPI types

type ServiceProviderReconciler

type ServiceProviderReconciler[T ServiceProviderAPI, PC ProviderConfig] interface {
	// CreateOrUpdate is called on every add or update event
	CreateOrUpdate(ctx context.Context, obj T, pc PC, clusters ClusterContext) (ctrl.Result, error)
	// Delete is called on every delete event
	Delete(ctx context.Context, obj T, pc PC, clusters ClusterContext) (ctrl.Result, error)
}

ServiceProviderReconciler implements any business logic required to manage ServiceProviderAPI objects

Jump to

Keyboard shortcuts

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