func ExtractTokenAndGetAuthClient(header http.Header) (authorizationv1.AuthorizationV1Interface, error)
ExtractTokenAndGetAuthClient extracts token from http header, and get the authority client of this token
func ExtractTokenAndGetClient(header http.Header) (pkgclient.Client, error)
ExtractTokenAndGetClient extracts token from http header, and get the k8s client of this token
func ExtractTokenFromHeader(header http.Header) string
ExtractTokenFromHeader extracts token from http header
type Clients interface { Client(token string) (pkgclient.Client, error) AuthClient(token string) (authorizationv1.AuthorizationV1Interface, error) Num() int Contains(token string) bool }
K8sClients is an object of Clients
var K8sClients Clients
func NewClientPool(localConfig *rest.Config, scheme *runtime.Scheme, maxClientNum int) (Clients, error)
New creates a new Clients
func NewLocalClient(localConfig *rest.Config, scheme *runtime.Scheme) (Clients, error)
Clients is the client pool of k8s client
type ClientsPool struct { sync.RWMutex // contains filtered or unexported fields }
func (c *ClientsPool) AuthClient(token string) (authorizationv1.AuthorizationV1Interface, error)
func (c *ClientsPool) Client(token string) (pkgclient.Client, error)
Client returns a k8s client according to the token
func (c *ClientsPool) Contains(token string) bool
Contains return true if have client for the token
func (c *ClientsPool) Num() int
Num returns the num of clients
type LocalClient struct {
// contains filtered or unexported fields
}
func (c *LocalClient) AuthClient(token string) (authorizationv1.AuthorizationV1Interface, error)
func (c *LocalClient) Client(token string) (pkgclient.Client, error)
Client returns the local k8s client
func (c *LocalClient) Contains(token string) bool
Contains return false for LocalClient
func (c *LocalClient) Num() int
Num returns the num of clients