client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterScoped

func ClusterScoped(config *Config)

ClusterScoped indicates that the operation should be invoked on a cluster scoped resource

Types

type Client

type Client interface {
	record.EventRecorder
	// Apply executes a k8s Server Side apply using the provided resource
	Apply(obj interface{}) error
	// OwnerReference returns a OwnerReferenceApplyConfiguration based upon the clients configured Owner
	OwnerReference() *metav1apply.OwnerReferenceApplyConfiguration
	// For returns a new Client implementation with the owner, used by OwnerReference, set to the provided Object
	For(owner client.Object) Client
	// WithNamespace returns a new client implementation with the specified namespace
	WithNamespace(namespace string) Client
	// Create a k8s resource
	Create(obj client.Object) error
	// Delete a k8s resource
	Delete(name string, obj client.Object, opts ...func(config *Config)) error
	// DeleteAllOf deletes all objects of the given type matching the given options.
	DeleteAllOf(set map[string]string, obj client.Object, opts ...func(config *Config)) error
	// List k8s resources with labels matching those in the provided set
	List(set map[string]string, list client.ObjectList, opts ...func(config *Config)) error
	// Load a k8s resource
	Load(name string, obj client.Object, opts ...func(config *Config)) error
	// Update a k8s resource
	Update(obj client.Object) error
	// UpdateStatus of a k8s resource
	UpdateStatus(obj client.Object) error
}

type Config

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

func (*Config) ClusterScoped

func (c *Config) ClusterScoped() bool

type OperationResult

type OperationResult string

OperationResult is the result of a CreateOrPatch or CreateOrUpdate call

const (
	// OperationResultNone means that the resource has not been changed
	OperationResultNone OperationResult = "unchanged"
	// OperationResultCreated means that a new resource is created
	OperationResultCreated OperationResult = "created"
	// OperationResultUpdated means that an existing resource is updated
	OperationResultUpdated OperationResult = "updated"
	// OperationResultUpdatedStatus means that an existing resource and its status is updated
	OperationResultUpdatedStatus OperationResult = "updatedStatus"
	// OperationResultUpdatedStatusOnly means that only an existing status is updated
	OperationResultUpdatedStatusOnly OperationResult = "updatedStatusOnly"
)

type Runtime

type Runtime struct {
	record.EventRecorder
	Client    runtimeClient.Client
	Ctx       context.Context
	Namespace string
	Owner     runtimeClient.Object
	Scheme    *runtime.Scheme
}

Runtime is a Client implementation based upon the controller-runtime client

func (*Runtime) Apply

func (c *Runtime) Apply(obj interface{}) error

func (*Runtime) Create

func (c *Runtime) Create(obj runtimeClient.Object) error

func (*Runtime) Delete

func (c *Runtime) Delete(name string, obj runtimeClient.Object, opts ...func(config *Config)) error

func (*Runtime) DeleteAllOf

func (c *Runtime) DeleteAllOf(set map[string]string, obj runtimeClient.Object, opts ...func(config *Config)) error

func (*Runtime) For

func (c *Runtime) For(owner runtimeClient.Object) Client

func (*Runtime) List

func (c *Runtime) List(set map[string]string, list runtimeClient.ObjectList, opts ...func(config *Config)) error

func (*Runtime) Load

func (c *Runtime) Load(name string, obj runtimeClient.Object, opts ...func(config *Config)) error

func (*Runtime) OwnerReference

func (*Runtime) Update

func (c *Runtime) Update(obj runtimeClient.Object) error

func (*Runtime) UpdateStatus

func (c *Runtime) UpdateStatus(obj runtimeClient.Object) error

func (*Runtime) WithNamespace

func (c *Runtime) WithNamespace(namespace string) Client

Jump to

Keyboard shortcuts

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