Documentation
¶
Index ¶
- Constants
- func StatusProgressing(obj API, reason, message string)
- func StatusReady(obj API)
- func StatusTerminating(obj API)
- type API
- type APIReconciler
- type APIReconcilerBuilder
- func (b *APIReconcilerBuilder[T, C]) ClusterAccessReconciler(car ClusterAccessProvider) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) EmptyObjectProvider(emptyObj func() T) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) MustBuild() *APIReconciler[T, C]
- func (b *APIReconcilerBuilder[T, C]) OnboardingCluster(c *clusters.Cluster) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) PlatformCluster(c *clusters.Cluster) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) ProviderConfig(config C) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) Reconciler(dsr Reconciler[T, C]) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) SecretNamespace(ns string) *APIReconcilerBuilder[T, C]
- func (b *APIReconcilerBuilder[T, C]) WorkloadCluster(wlCluster bool) *APIReconcilerBuilder[T, C]
- type ClusterAccessProvider
- type ClusterContext
- type Config
- type ConfigReconciler
- type ConfigReconcilerBuilder
- func (b *ConfigReconcilerBuilder[T]) EmptyObjectProvider(emptyObj func() T) *ConfigReconcilerBuilder[T]
- func (b *ConfigReconcilerBuilder[T]) MustBuild() *ConfigReconciler[T]
- func (b *ConfigReconcilerBuilder[T]) PlatformCluster(c *clusters.Cluster) *ConfigReconcilerBuilder[T]
- func (b *ConfigReconcilerBuilder[T]) ProviderName(name string) *ConfigReconcilerBuilder[T]
- func (b *ConfigReconcilerBuilder[T]) UpdateChannel(c chan event.GenericEvent) *ConfigReconcilerBuilder[T]
- type Reconciler
- type SecretWatcher
- type Status
Constants ¶
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 ¶
StatusProgressing indicates progressing with synced false
func StatusTerminating ¶
func StatusTerminating(obj API)
StatusTerminating indicates terminating with synced false
Types ¶
type APIReconciler ¶
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 ¶
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(car ClusterAccessProvider) *APIReconcilerBuilder[T, C]
ClusterAccessReconciler sets the cluster access reconciler.
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(dsr 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 ClusterAccessProvider ¶
type ClusterAccessProvider interface {
// MCPCluster creates a Cluster for the MCP AccessRequest.
// This function will only be successful if the MCP AccessRequest is granted and Reconcile returned without an error
// and a reconcile.Result with no RequeueAfter value.
MCPCluster(ctx context.Context, request reconcile.Request) (*clusters.Cluster, error)
// MCPAccessRequest returns the AccessRequest for the MCP cluster.
MCPAccessRequest(ctx context.Context, request reconcile.Request) (*clustersv1alpha1.AccessRequest, error)
// WorkloadCluster creates a Cluster for the Workload AccessRequest.
// This function will only be successful if the Workload AccessRequest is granted and Reconcile returned without an error
// and a reconcile.Result with no RequeueAfter value.
WorkloadCluster(ctx context.Context, request reconcile.Request) (*clusters.Cluster, error)
// WorkloadAccessRequest returns the AccessRequest for the Workload cluster.
WorkloadAccessRequest(ctx context.Context, request reconcile.Request) (*clustersv1alpha1.AccessRequest, error)
// Reconcile creates the ClusterRequests and AccessRequests for the MCP and Workload clusters based on the reconciled object.
// This function should be called during all reconciliations of the reconciled object.
// ctx is the context for the reconciliation.
// request is the object that is being reconciled
// It returns a reconcile.Result and an error if the reconciliation failed.
// The reconcile.Result may contain a RequeueAfter value to indicate that the reconciliation should be retried after a certain duration.
Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
// ReconcileDelete deletes the AccessRequests and ClusterRequests for the MCP and Workload clusters based on the reconciled object.
// This function should be called during the deletion of the reconciled object.
// ctx is the context for the reconciliation.
// request is the object that is being reconciled.
// It returns a reconcile.Result and an error if the reconciliation failed.
// The reconcile.Result may contain a RequeueAfter value to indicate that the reconciliation should be retried after a certain duration.
ReconcileDelete(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
}
ClusterAccessProvider is a light weight version of the ClusterAccessReconciler
type ClusterContext ¶
type ClusterContext struct {
// MCPCluster is the managed control plane that belongs to the current reconcile request
MCPCluster *clusters.Cluster
// MCPAccessSecretKey provides the object key to retrieve the MCP kubeconfig secret
MCPAccessSecretKey client.ObjectKey
// WorkloadCluster is the workload cluster that belongs the current reconcile request
WorkloadCluster *clusters.Cluster
// WorkloadAccessSecretKey provides the object key to retrieve the workload cluster kubeconfig secret
WorkloadAccessSecretKey client.ObjectKey
}
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 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 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 ¶
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 ClusterContext) (ctrl.Result, error) // Delete is called on every delete event Delete(ctx context.Context, obj T, config C, clusters 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 WithSecretNamespace.
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