client

package
v0.0.0-...-27ce056 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultQPS is the default globalClient QPS configuration. High enough QPS to fit all expected use cases.
	// QPS=0 is not set here, because globalClient code is overriding it.
	DefaultQPS = 1e6
	// DefaultBurst is the default globalClient burst configuration. High enough Burst to fit all expected use cases.
	// Burst=0 is not set here, because globalClient code is overriding it.
	DefaultBurst = 1e6
	// DefaultUserAgent is the default http header for user-agent
	DefaultUserAgent = "dashboard"
	// DefaultCmdConfigName is the default cluster/context/auth name to be set in clientcmd config
	DefaultCmdConfigName = "kubernetes"
	// ImpersonateUserHeader is the header name to identify username to act as.
	ImpersonateUserHeader = "Impersonate-User"
	// ImpersonateGroupHeader is the header name to identify group name to act as.
	// Can be provided multiple times to set multiple groups.
	ImpersonateGroupHeader = "Impersonate-Group"
	// ImpersonateUserExtraHeader is the header name used to associate extra fields with the user.
	// It is optional, and it requires ImpersonateUserHeader to be set.
	ImpersonateUserExtraHeader = "Impersonate-Extra-"
)

Variables

This section is empty.

Functions

func ConvertRestConfigToAPIConfig

func ConvertRestConfigToAPIConfig(restConfig *rest.Config) *clientcmdapi.Config

func GetBearerToken

func GetBearerToken(req *http.Request) string

func GetKarmadaClientFromRequest

func GetKarmadaClientFromRequest(request *http.Request) (karmadaclientset.Interface, error)

func GetKarmadaConfig

func GetKarmadaConfig() (*rest.Config, *clientcmdapi.Config, error)

func GetKubeConfig

func GetKubeConfig() (*rest.Config, *clientcmdapi.Config, error)

func HasAuthorizationHeader

func HasAuthorizationHeader(req *http.Request) bool

func InClusterClient

func InClusterClient() kubeclient.Interface

func InClusterClientForKarmadaApiServer

func InClusterClientForKarmadaApiServer() kubeclient.Interface

func InClusterKarmadaClient

func InClusterKarmadaClient() karmadaclientset.Interface

func InitKarmadaConfig

func InitKarmadaConfig(options ...Option)

func InitKubeConfig

func InitKubeConfig(options ...Option)

func KubeClientSetFromKubeConfig

func KubeClientSetFromKubeConfig(kubeconfig string) (*kubeclient.Clientset, error)

func LoadApiConfig

func LoadApiConfig(kubeconfig string, currentContext string) (*clientcmdapi.Config, error)

LoadApiConfig creates a clientcmdapi.Config using the passed kubeconfig. If currentContext is empty, current context in kubeconfig will be used.

func LoadRestConfig

func LoadRestConfig(kubeconfig string, context string) (*rest.Config, error)

LoadRestConfig creates a rest.Config using the passed kubeconfig. If context is empty, current context in kubeconfig will be used.

func LoadeRestConfigFromKubeConfig

func LoadeRestConfigFromKubeConfig(kubeconfig string) (*rest.Config, error)

func SetAuthorizationHeader

func SetAuthorizationHeader(req *http.Request, token string)

Types

type Option

type Option func(*configBuilder)

func WithInsecureTLSSkipVerify

func WithInsecureTLSSkipVerify(insecure bool) Option

func WithKubeContext

func WithKubeContext(kubecontext string) Option

func WithKubeconfig

func WithKubeconfig(path string) Option

func WithUserAgent

func WithUserAgent(agent string) Option

type ResourceVerber

type ResourceVerber interface {
	Update(object *unstructured.Unstructured) error
	Get(kind string, namespace string, name string) (runtime.Object, error)
	Delete(kind string, namespace string, name string, deleteNow bool) error
}

ResourceVerber is responsible for performing generic CRUD operations on all supported resources.

func VerberClient

func VerberClient(request *http.Request) (ResourceVerber, error)

Jump to

Keyboard shortcuts

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