client

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRDClient

type CRDClient interface {
	// EnsureCreated ensures a CRD exists and is ready
	Ensure(ctx context.Context, crd v1.CustomResourceDefinition, allowBreakingChanges bool) error

	// Delete removes a CRD if it exists
	Delete(ctx context.Context, name string) error

	// Get retrieves a CRD by name
	Get(ctx context.Context, name string) (*v1.CustomResourceDefinition, error)
}

CRDClient represents operations for managing CustomResourceDefinitions

type CRDInterface

type CRDInterface interface {
	// Ensure ensures a CRD exists, up-to-date, and is ready. This can be
	// a dangerous operation as it will update the CRD if it already exists.
	//
	// If allowBreakingChanges is false and the update contains breaking schema
	// changes, an error is returned. Set to true to force the update anyway.
	Ensure(ctx context.Context, crd v1.CustomResourceDefinition, allowBreakingChanges bool) error

	// Get retrieves a CRD by name
	Get(ctx context.Context, name string) (*v1.CustomResourceDefinition, error)

	// Delete removes a CRD if it exists
	Delete(ctx context.Context, name string) error
}

CRDInterface provides a simplified interface for CRD operations

type CRDWrapper

type CRDWrapper struct {
	// contains filtered or unexported fields
}

CRDWrapper provides a simplified interface for CRD operations

func (*CRDWrapper) Delete

func (w *CRDWrapper) Delete(ctx context.Context, name string) error

Delete removes a CRD if it exists

func (*CRDWrapper) Ensure

func (w *CRDWrapper) Ensure(ctx context.Context, desired v1.CustomResourceDefinition, allowBreakingChanges bool) error

Ensure ensures a CRD exists, up-to-date, and is ready. This can be a dangerous operation as it will update the CRD if it already exists.

If a CRD does exist, it will compare the existing CRD with the desired CRD and update it if necessary. If the existing CRD has breaking changes and allowBreakingChanges is false, it will return an error.

func (*CRDWrapper) Get

Get retrieves a CRD by name

type CRDWrapperConfig

type CRDWrapperConfig struct {
	Client       apiextensionsv1.ApiextensionsV1Interface
	PollInterval time.Duration
	Timeout      time.Duration
}

CRDWrapperConfig contains configuration for the CRD wrapper

func DefaultCRDWrapperConfig

func DefaultCRDWrapperConfig() CRDWrapperConfig

DefaultConfig returns a CRDWrapperConfig with default values

type Config

type Config struct {
	RestConfig      *rest.Config
	ImpersonateUser string
	QPS             float32
	Burst           int
}

Config holds configuration for client creation

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set provides a unified interface for different Kubernetes clients

func NewSet

func NewSet(cfg Config) (*Set, error)

NewSet creates a new client Set with the given config

func (*Set) APIExtensionsV1

func (c *Set) APIExtensionsV1() apiextensionsv1.ApiextensionsV1Interface

APIExtensionsV1 returns the API extensions client

func (*Set) CRD

func (c *Set) CRD(cfg CRDWrapperConfig) CRDInterface

CRD returns a new CRDInterface instance

func (*Set) Dynamic

func (c *Set) Dynamic() dynamic.Interface

Dynamic returns the dynamic client

func (*Set) HTTPClient

func (c *Set) HTTPClient() *http.Client

func (*Set) Kubernetes

func (c *Set) Kubernetes() kubernetes.Interface

Kubernetes returns the standard Kubernetes clientset

func (*Set) Metadata added in v0.6.0

func (c *Set) Metadata() metadata.Interface

Metadata returns the metadata client

func (*Set) RESTConfig

func (c *Set) RESTConfig() *rest.Config

RESTConfig returns a copy of the underlying REST config

func (*Set) RESTMapper

func (c *Set) RESTMapper() meta.RESTMapper

RESTMapper returns the REST mapper

func (*Set) SetRESTMapper

func (c *Set) SetRESTMapper(restMapper meta.RESTMapper)

SetRESTMapper sets the REST mapper for the client

func (*Set) WithImpersonation

func (c *Set) WithImpersonation(user string) (SetInterface, error)

WithImpersonation returns a new client that impersonates the given user

type SetInterface

type SetInterface interface {
	HTTPClient() *http.Client

	// Kubernetes returns the standard Kubernetes clientset
	Kubernetes() kubernetes.Interface

	// Dynamic returns the dynamic client
	Dynamic() dynamic.Interface

	// APIExtensionsV1 returns the API extensions client
	APIExtensionsV1() apiextensionsv1.ApiextensionsV1Interface

	// RESTConfig returns a copy of the underlying REST config
	RESTConfig() *rest.Config

	// CRD returns a new CRDInterface instance
	CRD(cfg CRDWrapperConfig) CRDInterface

	// WithImpersonation returns a new client that impersonates the given user
	WithImpersonation(user string) (SetInterface, error)

	RESTMapper() meta.RESTMapper
	SetRESTMapper(restMapper meta.RESTMapper)
}

SetInterface provides a unified interface for different Kubernetes clients

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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