cmdcontext

package
v0.0.0-...-351d49e Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCtxIsNil             = errors.New("context is nil when trying to get kube client")
	ErrCtxWithoutKubeClient = errors.New("context does not contain kube client")
)
View Source
var (
	ErrCtxWithoutClusterDetails = errors.New("context does not contain cluster info")
)

Functions

func ClusterDetailsFromContext

func ClusterDetailsFromContext(ctx context.Context) (*autodetect.ClusterDetails, error)

ClusterDetailsFromContext returns the current cluster details from ctx.

func ClusterDetailsFromContextOrExit

func ClusterDetailsFromContextOrExit(ctx context.Context) *autodetect.ClusterDetails

ClusterDetailsFromContextOrExit returns the current cluster details from ctx.

If no details are currently set in ctx the program will exit with an error message.

func ClusterKindFromContext

func ClusterKindFromContext(ctx context.Context) autodetect.Kind

ClusterKindFromContext returns the current cluster kind from ctx. If no kind is currently set in ctx, it returns autodetect.KindUnknown

func ContextWithClusterDetails

func ContextWithClusterDetails(parent context.Context, clusterDetails *autodetect.ClusterDetails) context.Context

ContextWithClusterDetails returns a copy of parent with ClusterDetails set as the current details.

func ContextWithKubeClient

func ContextWithKubeClient(parent context.Context, kubeClient *kube.Client) context.Context

ContextWithKubeClient returns a copy of parent with kubeClient set as the current client.

func K8SVersionFromContext

func K8SVersionFromContext(ctx context.Context) *version.Version

K8SVersionFromContext returns the current k8s version from ctx. If no version is currently set in ctx, it returns nil

func KubeClientFromContext

func KubeClientFromContext(ctx context.Context) (*kube.Client, error)

KubeClientFromContext returns the current kube client from ctx.

func KubeClientFromContextOrExit

func KubeClientFromContextOrExit(ctx context.Context) *kube.Client

KubeClientFromContextOrExit returns the current kube client from ctx.

If no client is currently set in ctx the program will exit with an error message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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