Documentation ¶
Index ¶
- Variables
- func NewCustomTransport(config *rest.Config, semaphore chan struct{}, logger logging.Logger) *customTransport
- type Client
- type ClientConfig
- type ClientOption
- func WithInCluster(inCluster bool) ClientOption
- func WithKubeconfigPath(kubeconfigPath string) ClientOption
- func WithLogger(logger logging.Logger) ClientOption
- func WithMockClientConfig(cs *ClientConfig) ClientOption
- func WithRequestLimiter(rateLimiter flowcontrol.RateLimiter, maxConcurentRequests int) ClientOption
Constants ¶
This section is empty.
Variables ¶
var ErrKubeconfigNotSet = errors.New("kubeconfig is not set")
ErrKubeconfigNotSet represents error when kubeconfig is empty string.
Functions ¶
Types ¶
type Client ¶
type Client struct { // exported services that K8S provides ConfigMap *configmap.Client Ingress *ingress.Client Namespace *namespace.Client Pods *pod.Client PVC *persistentvolumeclaim.Client Secret *secret.Client ServiceAccount *serviceaccount.Client Service *service.Client StatefulSet *statefulset.Client IngressRoute *ingressroute.Client // contains filtered or unexported fields }
Client manages communication with the Kubernetes.
func NewClient ¶
func NewClient(opts ...ClientOption) (c *Client, err error)
NewClient returns a new Kubernetes client.
type ClientConfig ¶ added in v0.12.3
type ClientConfig struct { NewForConfig func(c *rest.Config) (*kubernetes.Clientset, error) // kubernetes.NewForConfig NewIngressRouteClientForConfig func(c *rest.Config) (*ingressroute.CustomResourceClient, error) // ingressroute.NewForConfig InClusterConfig func() (*rest.Config, error) // rest.InClusterConfig BuildConfigFromFlags func(masterUrl string, kubeconfigPath string) (*rest.Config, error) // clientcmd.BuildConfigFromFlags FlagString func(name string, value string, usage string) *string // flag.String FlagParse func() // flag.Parse OsUserHomeDir func() (string, error) // os.UserHomeDir }
ClientConfig holds functions for configration of the Kubernetes client. Functions are extracted to be able to mock them in tests.
type ClientOption ¶ added in v0.12.3
type ClientOption func(*Client)
ClientOption holds optional parameters for the Client.
func WithInCluster ¶ added in v0.12.3
func WithInCluster(inCluster bool) ClientOption
WithInCluster sets the inCluster flag for the Client.
func WithKubeconfigPath ¶ added in v0.12.3
func WithKubeconfigPath(kubeconfigPath string) ClientOption
WithKubeconfigPath sets the kubeconfigPath for the Client.
func WithLogger ¶ added in v0.12.3
func WithLogger(logger logging.Logger) ClientOption
WithLogger sets the logger for the Client.
func WithMockClientConfig ¶ added in v0.12.3
func WithMockClientConfig(cs *ClientConfig) ClientOption
WithMockClientConfig sets the ClientConfig function, which is used for only when mocking.
func WithRequestLimiter ¶ added in v0.12.3
func WithRequestLimiter(rateLimiter flowcontrol.RateLimiter, maxConcurentRequests int) ClientOption
WithRequestLimiter sets the rateLimiter and maxConcurentRequests for the Client.