Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Clusters Client context key ClustersClientCtxKey key = iota )
View Source
const DefaultCluster = "Default"
Variables ¶
This section is empty.
Functions ¶
func WithClustersClient ¶
func WithClustersClient(clustersFetcher ClusterFetcher, next http.Handler) http.Handler
WithClustersClient creates clusters client for provided user in the context
Types ¶
type Client ¶
type Client interface { // Get retrieves an obj for the given object key. Get(ctx context.Context, cluster string, key client.ObjectKey, obj client.Object) error // List retrieves list of objects for a given namespace and list options. List(ctx context.Context, cluster string, list client.ObjectList, opts ...client.ListOption) error // Create saves the object obj. Create(ctx context.Context, cluster string, obj client.Object, opts ...client.CreateOption) error // Delete deletes the given obj Delete(ctx context.Context, cluster string, obj client.Object, opts ...client.DeleteOption) error // Update updates the given obj. Update(ctx context.Context, cluster string, obj client.Object, opts ...client.UpdateOption) error // Patch patches the given obj Patch(ctx context.Context, cluster string, obj client.Object, patch client.Patch, opts ...client.PatchOption) error // ClusteredList retrieves list of objects for all clusters. ClusteredList(ctx context.Context, clist ClusteredObjectList, opts ...client.ListOption) error // ClientsPool returns the clients pool. ClientsPool() ClientsPool }
Client thin wrapper to controller-runtime/client adding multi clusters context.
func ClientFromCtx ¶
ClientFromCtx returns the ClusterClient stored in the context
func NewClient ¶
func NewClient(clientsPool ClientsPool) Client
type ClientsPool ¶
type ClientsPool interface { Add(user *auth.UserPrincipal, cluster Cluster) error Clients() map[string]client.Client Client(cluster string) (client.Client, error) }
ClientsPool stores all clients to the leaf clusters
func NewClustersClientsPool ¶
func NewClustersClientsPool() ClientsPool
NewClustersClientsPool initializes a new ClientsPool
type Cluster ¶
type Cluster struct { // Name defines the cluster name Name string `yaml:"name"` // Server defines cluster api address Server string `yaml:"server"` // SecretRef defines secret name that holds the cluster Bearer Token SecretRef string `yaml:"secretRef"` // BearerToken cluster access token read from SecretRef BearerToken string // TLSConfig holds configuration for TLS connection with the cluster values read from SecretRef TLSConfig rest.TLSClientConfig }
Cluster defines a leaf cluster
type ClusterFetcher ¶
ClusterFetcher fetches all leaf clusters
func NewSingleClusterFetcher ¶
func NewSingleClusterFetcher(config *rest.Config) (ClusterFetcher, error)
type ClusterNotFoundError ¶
type ClusterNotFoundError struct {
Cluster string
}
ClusterNotFoundError cluster client can be found in the pool
func (ClusterNotFoundError) Error ¶
func (e ClusterNotFoundError) Error() string
type ClusteredList ¶
func (*ClusteredList) Lists ¶
func (cl *ClusteredList) Lists() map[string]client.ObjectList
func (*ClusteredList) ObjectList ¶
func (cl *ClusteredList) ObjectList(cluster string) client.ObjectList
type ClusteredObjectList ¶
type ClusteredObjectList interface { ObjectList(cluster string) client.ObjectList Lists() map[string]client.ObjectList }
func NewClusteredList ¶
func NewClusteredList(listFactory func() client.ObjectList) ClusteredObjectList
Click to show internal directories.
Click to hide internal directories.