clientpool

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTokenAndGetAuthClient

func ExtractTokenAndGetAuthClient(header http.Header) (authorizationv1.AuthorizationV1Interface, error)

ExtractTokenAndGetAuthClient extracts token from http header, and get the authority client of this token

func ExtractTokenAndGetClient

func ExtractTokenAndGetClient(header http.Header) (pkgclient.Client, error)

ExtractTokenAndGetClient extracts token from http header, and get the k8s client of this token

func ExtractTokenFromHeader

func ExtractTokenFromHeader(header http.Header) string

ExtractTokenFromHeader extracts token from http header

Types

type Clients

type Clients interface {
	Client(token string) (pkgclient.Client, error)
	AuthClient(token string) (authorizationv1.AuthorizationV1Interface, error)
	Num() int
	Contains(token string) bool
}
var K8sClients Clients

K8sClients is an object of Clients

func NewClientPool

func NewClientPool(localConfig *rest.Config, scheme *runtime.Scheme, maxClientNum int) (Clients, error)

New creates a new Clients

func NewLocalClient

func NewLocalClient(localConfig *rest.Config, scheme *runtime.Scheme) (Clients, error)

type ClientsPool

type ClientsPool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Clients is the client pool of k8s client

func (*ClientsPool) AuthClient

func (*ClientsPool) Client

func (c *ClientsPool) Client(token string) (pkgclient.Client, error)

Client returns a k8s client according to the token

func (*ClientsPool) Contains

func (c *ClientsPool) Contains(token string) bool

Contains return true if have client for the token

func (*ClientsPool) Num

func (c *ClientsPool) Num() int

Num returns the num of clients

type LocalClient

type LocalClient struct {
	// contains filtered or unexported fields
}

func (*LocalClient) AuthClient

func (*LocalClient) Client

func (c *LocalClient) Client(token string) (pkgclient.Client, error)

Client returns the local k8s client

func (*LocalClient) Contains

func (c *LocalClient) Contains(token string) bool

Contains return false for LocalClient

func (*LocalClient) Num

func (c *LocalClient) Num() int

Num returns the num of clients

Jump to

Keyboard shortcuts

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