kube

package
v0.0.0-...-bcbb9e7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientProvider

type ClientProvider struct {
	// RestConfig is the kubernetes client configuration
	RestConfig *rest.Config
	// KubeconfigPath is the path to the kubeconfig file
	KubeconfigPath string
	// ContextName is the kubernetes context to use
	ContextName string
	// UseInClusterConfig indicates whether to use in-cluster configuration
	UseInClusterConfig bool
	// Clientset is a direct Kubernetes clientset instance
	Clientset *kubernetes.Clientset
}

ClientProvider handles Kubernetes client creation and configuration

func NewClientProvider

func NewClientProvider() *ClientProvider

NewClientProvider creates a new ClientProvider with default settings

func NewClientProviderWithOptions

func NewClientProviderWithOptions(options ...Option) *ClientProvider

NewClientProviderWithOptions creates a new ClientProvider with the given options

func (*ClientProvider) GetClientset

func (p *ClientProvider) GetClientset() (*kubernetes.Clientset, error)

GetClientset returns a kubernetes clientset based on the provider settings

func (*ClientProvider) GetConfig

func (p *ClientProvider) GetConfig() (*rest.Config, error)

GetConfig returns a kubernetes rest.Config based on the provider settings

func (*ClientProvider) GetCurrentNamespace

func (p *ClientProvider) GetCurrentNamespace() (string, error)

GetCurrentNamespace returns the current namespace from the context

func (*ClientProvider) WithClientset

func (p *ClientProvider) WithClientset(clientset *kubernetes.Clientset) *ClientProvider

WithClientset sets a direct kubernetes clientset

func (*ClientProvider) WithContextName

func (p *ClientProvider) WithContextName(name string) *ClientProvider

WithContextName sets the kubernetes context to use

func (*ClientProvider) WithKubeconfigPath

func (p *ClientProvider) WithKubeconfigPath(path string) *ClientProvider

WithKubeconfigPath sets the path to the kubeconfig file

func (*ClientProvider) WithRestConfig

func (p *ClientProvider) WithRestConfig(config *rest.Config) *ClientProvider

WithRestConfig sets a specific rest.Config for the client

type Option

type Option func(*ClientProvider)

Option is a function that configures a ClientProvider

func UseDefaultConfig

func UseDefaultConfig() Option

UseDefaultConfig creates an option to configure a ClientProvider to use default in-cluster or kubeconfig configuration

func WithClientset

func WithClientset(clientset *kubernetes.Clientset) Option

WithClientset creates an option to configure a ClientProvider with a direct kubernetes clientset

func WithContextName

func WithContextName(name string) Option

WithContextName creates an option to configure a ClientProvider with a specific context name

func WithKubeconfigPath

func WithKubeconfigPath(path string) Option

WithKubeconfigPath creates an option to configure a ClientProvider with a specific kubeconfig path

func WithRestConfig

func WithRestConfig(config *rest.Config) Option

WithRestConfig creates an option to configure a ClientProvider with a specific rest.Config

Jump to

Keyboard shortcuts

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