client

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigWithContext

func GetConfigWithContext(kubeConfigPath, kubeContext string) (*rest.Config, error)

GetConfigWithContext returns kubernetes config based on the current environment. If kubeConfigPath is provided, loads configuration from that file. Otherwise, GetConfigWithContext uses default strategy to load configuration from $KUBECONFIG, .kube/config, or just returns in-cluster config.

func GetScheme

func GetScheme() *runtime.Scheme

GetScheme gets an initialized runtime.Scheme with k8s core added by default

func NewClient

func NewClient(config *rest.Config, options Options) (client.Client, error)

NewClient returns a new Client using the provided config and Options. The returned client reads *and* writes directly from the server (it doesn't use object caches). It understands how to work with normal types (both custom resources and aggregated/built-in resources), as well as unstructured types.

In the case of normal types, the scheme will be used to look up the corresponding group, version, and kind for the given type. In the case of unstructured types, the group, version, and kind will be extracted from the corresponding fields on the object.

func NewClientFromKubeConfigAndContext

func NewClientFromKubeConfigAndContext(kubeConfigPath, kubeContext string) (client.Client, error)

Types

type Options

type Options struct {
	// Scheme, if provided, will be used to map go structs to GroupVersionKinds
	Scheme *runtime.Scheme

	// Mapper, if provided, will be used to map GroupVersionKinds to Resources
	Mapper meta.RESTMapper
}

Options are creation options for a Client

Jump to

Keyboard shortcuts

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