kubernetes

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToUnstructured

func ToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error)

ToUnstructured converts a runtime.Object into an Unstructured object.

Types

type Applier

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

Applier is used to create/update/delete one or more objects from a YAML manifest file to the cluster @TODO: Remove this in favor of Client in client.go which provides server side apply

func NewApplier

func NewApplier(logger logr.Logger, client client.Client) *Applier

NewApplier creates an Applier instance

func (*Applier) Apply

func (a *Applier) Apply(ctx context.Context, reader UnstructuredReader) error

Apply reads the manifest objects from the reader, and then either create or update the objects in the cluster. @TODO: Continue on failure to create/update object and return failed objects

func (*Applier) ApplyObjects

func (a *Applier) ApplyObjects(ctx context.Context, objs []*unstructured.Unstructured) error

ApplyObjects create or update the provided objects in the cluster.

func (*Applier) Delete

func (a *Applier) Delete(ctx context.Context, objs []*unstructured.Unstructured) error

Delete deletes the provided objects from the cluster.

type Client

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

Client is a wrapper around the controller-runtime client.Client that provides a higher-level API for working with unstructured objects.

func NewClient

func NewClient(logger logr.Logger, runtimeClient client.Client) *Client

NewClient creates a new Client

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, obj client.Object) error

Apply applies the changes to the object in the cluster using server-side apply. If the object does not exist, it will be created using Create() If the object exists, it will be updated using Patch()

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, obj client.Object) error

type UnstructuredReader

type UnstructuredReader interface {
	ReadManifest() ([]*unstructured.Unstructured, error)
}

UnstructuredReader an interface that all manifest readers should implement

func NewManifestReader

func NewManifestReader(manifest []byte) UnstructuredReader

NewManifestReader initializes a reader for yaml manifests

Jump to

Keyboard shortcuts

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