k8sapi

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(c *client.Client, obj, owner client.Object, action ActionFunc) error

Apply is a functional interface for interacting with the K8s apiserver in a consistent way. Each sigs.k8s.io/controller-runtime/pkg/client.Object argument must implement the necessary Reader/Writer interfaces implemented by sigs.k8s.io/controller-runtime/pkg/client.Client.

func CreateOrUpdate

func CreateOrUpdate(c client.Client, obj client.Object) (string, error)

CreateOrUpdate is an Action that applies a resource in the K8s apiserver.

func GetOrCreate

func GetOrCreate(c client.Client, obj client.Object) (string, error)

GetOrCreate is an Action that ensures a resource exists in the K8s apiserver.

Types

type ActionFunc

type ActionFunc func(client.Client, client.Object) (string, error)

ActionFunc is a type of function that makes a sequence of API calls to a K8s apiserver. If any API call fails, the ActionFunc should return a string describing the failed call, plus the error returned by the sigs.k8s.io/controller-runtime/pkg/client.Client. Otherwise, the ActionFunc should return a string describing its successful result, and a nil error.

func MkPatchAction

func MkPatchAction(patch func(client.Object) client.Object) ActionFunc

MkPatchAction returns an Action that applies the patch specified when called.

Jump to

Keyboard shortcuts

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