Documentation
¶
Index ¶
- type ClientProvider
- func (p *ClientProvider) GetClientset() (*kubernetes.Clientset, error)
- func (p *ClientProvider) GetConfig() (*rest.Config, error)
- func (p *ClientProvider) GetCurrentNamespace() (string, error)
- func (p *ClientProvider) WithClientset(clientset *kubernetes.Clientset) *ClientProvider
- func (p *ClientProvider) WithContextName(name string) *ClientProvider
- func (p *ClientProvider) WithKubeconfigPath(path string) *ClientProvider
- func (p *ClientProvider) WithRestConfig(config *rest.Config) *ClientProvider
- type Option
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 ¶
WithContextName creates an option to configure a ClientProvider with a specific context name
func WithKubeconfigPath ¶
WithKubeconfigPath creates an option to configure a ClientProvider with a specific kubeconfig path
func WithRestConfig ¶
WithRestConfig creates an option to configure a ClientProvider with a specific rest.Config