Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClusterAccess ¶
func GetClusterAccess(ctx context.Context, serviceAccountNamespace, adminServiceAccount string, adminAccess *openmcpv1alpha1.APIServerAccess, cae ClusterAccessEnabler) (*openmcpv1alpha1.APIServerAccess, time.Duration, error)
GetClusterAccess is a helper function to get admin and user kubeconfigs for an APIServer. It takes a possible existing admin and user access (or nil), as well as a ClusterAccessEnabler which provides initial access to the cluster. It returns an admin access, a user access, and the computed duration after which the APIServer should be reconciled to renew the kubeconfigs, if required.
Types ¶
type APIServerHandler ¶
type APIServerHandler interface {
// HandleCreateOrUpdate handles creation/update of the APIServer.
// It returns a reconcile result, an update function to update the status with, conditions that determine health/readiness of the cluster, and potentially an error that occurred.
// The status' condition will be overwritten based on the other returned values.
HandleCreateOrUpdate(ctx context.Context, dp *openmcpv1alpha1.APIServer, crateClient client.Client) (ctrl.Result, UpdateStatusFunc, []openmcpv1alpha1.ComponentCondition, openmcperrors.ReasonableError)
// HandleDelete handles the deletion of the APIServer.
// It returns a reconcile result, an update function to update the status with, conditions that determine health/readiness of the cluster (deletion), and potentially an error that occurred.
HandleDelete(ctx context.Context, dp *openmcpv1alpha1.APIServer, crateClient client.Client) (ctrl.Result, UpdateStatusFunc, []openmcpv1alpha1.ComponentCondition, openmcperrors.ReasonableError)
}
APIServerHandler is an interface for the handlers for the different APIServer types.
type ClusterAccessEnabler ¶
type ClusterAccessEnabler interface {
// Init is called before Client and RESTConfig. It is called only if access to the cluster is actually required.
// This can be used to put expensive operations into which should not be executed always - which would happen if they were in the constructor - but only when actually needed.
Init(ctx context.Context) error
// Client returns a client for accessing the cluster.
Client() client.Client
// RESTConfig returns the rest config for the cluster. The information from here is used for kubeconfig construction.
RESTConfig() *rest.Config
}
ClusterAccessEnabler is a helper interface. It is used to initially access the cluster in order to create serviceaccounts and generate kubeconfigs for them.
type UpdateStatusFunc ¶
type UpdateStatusFunc func(*openmcpv1alpha1.APIServerStatus) error
UpdateStatusFunc is expected to update all component-specific fields in the status.