Documentation ¶
Index ¶
- Variables
- func CreateClientOrDie(opts ...ClientOption) (*rest.Config, client.Client)
- func CreateClientWithKubeconfigOrDie(config *clientcmdapi.Config) (*rest.Config, client.Client)
- func CreateScheme() *runtime.Scheme
- func ForEachResource(clientConfig *rest.Config, embeddedString string, ...) (errors []string)
- func LoadClientConfig(opts ...ClientOption) *rest.Config
- func LoadDefaultClientConfig()
- func LoadProvidedConfig(config *clientcmdapi.Config)
- type ClientOption
- type ClientOptions
Constants ¶
This section is empty.
Variables ¶
var ( TimeoutFlagValue time.Duration NamespaceFlagValue string ContextOverrideFlagValue string K8sClient client.Client RestConfig *rest.Config )
var Log *zap.SugaredLogger
Log is a shared logger that can be used in all opnictl commands.
Functions ¶
func CreateClientOrDie ¶
func CreateClientOrDie(opts ...ClientOption) (*rest.Config, client.Client)
CreateClientOrDie constructs a new controller-runtime client, or exit with a fatal error if an error occurs.
func CreateScheme ¶
CreateScheme creates a new scheme with the types necessary for opnictl.
func ForEachResource ¶
func ForEachResource( clientConfig *rest.Config, embeddedString string, callback func(dynamic.ResourceInterface, *unstructured.Unstructured) error, ) (errors []string)
ForEachResource will call the given callback function for each Kubernetes resource in the embedded string. See the manifests package for more details. This function will not abort if the callback returns an error, rather it will collect all errors that have been returned and return them all at once.
func LoadClientConfig ¶
func LoadClientConfig(opts ...ClientOption) *rest.Config
LoadClientConfig loads the user's kubeconfig using the same logic as kubectl.
func LoadDefaultClientConfig ¶
func LoadDefaultClientConfig()
func LoadProvidedConfig ¶
func LoadProvidedConfig(config *clientcmdapi.Config)
Types ¶
type ClientOption ¶
type ClientOption func(*ClientOptions)
func MaybeContextOverride ¶
func MaybeContextOverride() []ClientOption
MaybeContextOverride will return 0 or 1 ClientOptions, depending on if the user provided a specific kubectl context or not.
func WithConfigOverrides ¶
func WithConfigOverrides(overrides *clientcmd.ConfigOverrides) ClientOption
WithConfigOverrides allows overriding specific kubeconfig fields from the user's loaded kubeconfig.
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
ClientOptions can be passed to some of the functions in this package when creating clients and/or client configurations.
func (*ClientOptions) Apply ¶
func (o *ClientOptions) Apply(opts ...ClientOption)