bootstrapper

package
v0.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldManager = "platform-bootstrapper"
)

Variables

View Source
var (
	ErrCreateKubeClient            = errors.New("unable to create kubernetes client")
	ErrCreateDiscoveryClient       = errors.New("unable to create discovery client")
	ErrGetAPIResources             = errors.New("unable to retrieve the api resources")
	ErrGetRESTMapping              = errors.New("unable to retrieve rest mapping")
	ErrMissingResource             = errors.New("unable to use nil resource")
	ErrMissingGroupVersionResource = errors.New("unable to use nil group version resource")
)

Functions

func HasOption

func HasOption(options []Option, option Option) bool

func ResourceMessage

func ResourceMessage(resource *unstructured.Unstructured) string

ResourceMessage returns the string used for logging messages for resources.

Types

type Bootstrapper

type Bootstrapper struct {
	Context context.Context
	Client  *Client
	Log     zerolog.Logger
}

Bootstrapper represents the object that is performing the bootstrapping process.

func NewBootstrapper

func NewBootstrapper(client *Client, options ...Option) *Bootstrapper

NewBootstrapper returns a new instance of a bootstrapper object.

func (*Bootstrapper) Apply

Apply runs the specific apply action for the bootstrapper.

func (*Bootstrapper) Destroy

Destroy runs the specific destroy action for the bootstrapper.

func (*Bootstrapper) RunAction

func (b *Bootstrapper) RunAction(action bootstrapAction, resources ...*unstructured.Unstructured) error

RunAction runs a specific bootstrap action against a set of resources.

type Client

type Client struct {
	Context context.Context
	Client  *dynamic.DynamicClient
	Config  *rest.Config
	API     *restmapper.DeferredDiscoveryRESTMapper
}

Client represents the boostrapper client which is used to interact with the Kubernetes API for bootstrapping resources.

func NewClient

func NewClient(ctx context.Context, kubeconfigFile string) (client *Client, err error)

NewClient returns a new instance of a client object.

func (*Client) Apply

func (client *Client) Apply(resource *unstructured.Unstructured, gvr *schema.GroupVersionResource) error

Apply applies a particular resource to a cluster.

func (*Client) Destroy

func (client *Client) Destroy(resource *unstructured.Unstructured, gvr *schema.GroupVersionResource) error

Destroy removes a particular resource from a cluster.

func (*Client) GetGroupVersionResource

func (client *Client) GetGroupVersionResource(gvk schema.GroupVersionKind) (*schema.GroupVersionResource, error)

GetGroupVersionResource returns the GroupVersionResource object from a particular resource.

func (*Client) WaitForDestroy

func (client *Client) WaitForDestroy(resource *unstructured.Unstructured, gvr *schema.GroupVersionResource) error

WaitForMissing waits for a particular resource to be missing.

func (*Client) WaitForReady

func (client *Client) WaitForReady(resource *unstructured.Unstructured, gvr *schema.GroupVersionResource) error

WaitForReady waits for a particular resource to be ready.

type Option

type Option int
const (
	WithUnknownOption Option = iota
	WithDebug
)

Jump to

Keyboard shortcuts

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