clientconfig

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientAndNamespaceFromContext

func ClientAndNamespaceFromContext(ctx context.Context) (client kubeclient.Client, namespace string, overridden bool, err error)

func ForwardedFlags added in v1.11.1

func ForwardedFlags(cmd *cobra.Command, quote func(string) string) []string

ForwardedFlags returns the `--name=value` tokens for the cluster-selection flags the user set on cmd. Each value goes through quote, so the caller picks the escaping its embedding needs.

func GetRESTConfig added in v1.4.0

func GetRESTConfig(ctx context.Context) (*rest.Config, error)

func NamespaceFromContext added in v1.11.1

func NamespaceFromContext(ctx context.Context) (string, error)

NamespaceFromContext returns the namespace from the active kubeconfig context.

func NewContext

func NewContext(ctx context.Context, clientConfig clientcmd.ClientConfig) context.Context

NewContext returns a new Context that stores a clientConfig as value.

func ShellEscape added in v1.11.1

func ShellEscape(s string) string

ShellEscape backslash-escapes every character /bin/sh would otherwise interpret. Use it instead of ShellQuote where single quotes are already taken by an enclosing layer, as in the ansible_ssh_common_args value.

That value is re-parsed twice: ansible splits it with shlex, then ssh hands the ProxyCommand to /bin/sh. shlex keeps a backslash literal inside single quotes, which is what makes the plain escaping work for every other character. A single quote is the exception: it closes the quoted run no matter what precedes it, so it has to leave the run, arrive at /bin/sh as \' and reopen the run afterwards.

func ShellQuote added in v1.11.1

func ShellQuote(s string) string

ShellQuote single-quotes s so it survives being re-parsed by /bin/sh, which runs the ProxyCommand.

Types

This section is empty.

Jump to

Keyboard shortcuts

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