Documentation ¶
Index ¶
- Constants
- func LoadConfigFile(configFilePath string) (*api.Config, error)
- func NewClientConfig(options *ConfigOptions) (*rest.Config, error)
- func NewClientConfigFromLocal(options *ConfigOptions) (*rest.Config, error)
- func NewRuntimeClient(config *rest.Config) (runtimeclient.Client, error)
- func PatchNamespace(ctx context.Context, client runtime_client.Client, namespace string) error
- type Clients
- type ConfigOptions
- type ObjectManifest
Constants ¶
const ( // DefaultServerBurst is the default number of queries per second for server. DefaultServerQPS float32 = 200.0 // DefaultServerBurst is the default number of queries k8sclient handles concurrently for server. DefaultServerBurst int = 200 // DefaultCLIQPS is the default number of queries per second for CLI. DefaultCLIQPS float32 = 50.0 // DefaultCLIBurst is the default number of queries k8sclient handles concurrently for CLI. DefaultCLIBurst int = 100 )
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFile ¶
LoadConfigFile loads the Kubernetes config file from the given path, or will load the default config from the home directory if no path is provided.
func NewClientConfig ¶
func NewClientConfig(options *ConfigOptions) (*rest.Config, error)
NewClientConfig builds a Kubernetes client config from either in-cluster or local configuration, and sets the QPS and Burst values if provided. It returns an error if the config cannot be built.
func NewClientConfigFromLocal ¶
func NewClientConfigFromLocal(options *ConfigOptions) (*rest.Config, error)
NewClientConfigFromLocal builds a Kubernetes client config from a ConfigOptions instance, loading the config file from the ConfigFilePath and setting the QPS and Burst values if specified. It returns an error if the config file cannot be loaded or the client config cannot be initialized.
func NewRuntimeClient ¶
func NewRuntimeClient(config *rest.Config) (runtimeclient.Client, error)
NewRuntimeClient creates a new runtime client using the given config and adds the required resource schemes to the client.
func PatchNamespace ¶
PatchNamespace creates a new namespace with the given name and labels it with the given label, then applies it to the cluster. It returns an error if the patch operation fails.
Types ¶
type Clients ¶
type Clients struct { // RuntimeClient is the Kubernetes controller runtime client. RuntimeClient runtimeclient.Client // ClientSet is the Kubernetes client-go strongly-typed client. ClientSet *kubernetes.Clientset // DiscoveryClient is the Kubernetes client-go discovery client. DiscoveryClient *discovery.DiscoveryClient // DynamicClient is the Kubernetes client-go dynamic client. DynamicClient dynamic.Interface }
Clients is a collection of Kubernetes clients.
type ConfigOptions ¶
ConfigOptions is custom options to configure kubernetes client config.
type ObjectManifest ¶
type ObjectManifest map[schema.GroupVersionKind][]runtime.Object
ObjectManifest is a map of runtime.Object slice where the key is GroupVersionKind for the resource.
func ParseManifest ¶
func ParseManifest(data []byte) (ObjectManifest, error)
ParseManifest parses the given manifest and returns a map of runtime.Object slice where the key is GroupVersionKind for the resource. It returns an error if the given manifest is invalid.
func (ObjectManifest) Get ¶
func (m ObjectManifest) Get(gvk schema.GroupVersionKind) []runtime.Object
Get returns a runtime.Object slice for the given key.
func (ObjectManifest) GetFirst ¶
func (m ObjectManifest) GetFirst(gvk schema.GroupVersionKind) runtime.Object
GetFirst returns the first runtime.Object for the given key.