clusteraccess

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// WithTimeout sets the timeout for operations.
	WithTimeout(timeout time.Duration) Manager
	// WithInterval sets the interval for polling operations.
	WithInterval(interval time.Duration) Manager
	// WithLogger sets the logger for the manager.
	WithLogger(log *logging.Logger) Manager

	// CreateAndWaitForCluster creates a new ClusterRequest/AccessRequest and waits for it to be ready.
	// It returns the created Cluster if the AccessRequest is granted.
	// ctx is the context for the operation.
	// clusterName is the name of the cluster to create.
	// purpose is the purpose of the cluster (e.g., "onboarding", "mcp", "workload").
	// scheme is the runtime scheme to use for the cluster.
	// permissions are the permissions to request for the AccessRequest.
	CreateAndWaitForCluster(ctx context.Context, clusterName, purpose string,
		scheme *runtime.Scheme, permissions []clustersv1alpha1.PermissionsRequest) (*clusters.Cluster, error)
}

Manager is an interface for managing cluster access.

func NewClusterAccessManager

func NewClusterAccessManager(platformClusterClient client.Client, controllerName, controllerNamespace string) Manager

NewClusterAccessManager creates a new Manager with the given parameters.

type Reconciler

type Reconciler interface {
	// WithRetryInterval sets the retry interval
	WithRetryInterval(interval time.Duration) Reconciler
	// WithMCPPermissions sets the permissions for the MCP AccessRequest.
	WithMCPPermissions(permissions []clustersv1alpha1.PermissionsRequest) Reconciler
	// WithWorkloadPermissions sets the permissions for the Workload AccessRequest.
	WithWorkloadPermissions(permissions []clustersv1alpha1.PermissionsRequest) Reconciler
	// WithMCPScheme sets the scheme for the MCP Kubernetes client.
	WithMCPScheme(scheme *runtime.Scheme) Reconciler
	// WithWorkloadScheme sets the scheme for the Workload Kubernetes client.
	WithWorkloadScheme(scheme *runtime.Scheme) Reconciler

	// 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)
	// 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)

	// 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.
	// The duration is set by the WithRetryInterval method.
	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.
	// The duration is set by the WithRetryInterval method.
	ReconcileDelete(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
}

Reconciler is an interface for reconciling access to openMCP clusters. It creates and manages AccessRequests and ClusterRequests for MCP and Workload clusters. The Reconciler is being used by service providers to manager the access to an MCP and Workload cluster that are being manged for an instance of a service provider resource.

func NewClusterAccessReconciler

func NewClusterAccessReconciler(platformClusterClient client.Client, controllerName string) Reconciler

NewClusterAccessReconciler creates a new ClusterAccessReconciler with the given parameters. platformClusterClient is the client to the platform cluster where the AccessRequests and ClusterRequests are created. controllerName is the name of the Kubernetes controller, used to create stable request names.

Jump to

Keyboard shortcuts

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