kubeapply

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandResource

func ExpandResource(ctx context.Context, path string) (result []byte, err error)

ExpandResource takes a path to a YAML file, and returns its contents, with any kubeapply templating expanded.

func Kubeapply

func Kubeapply(ctx context.Context, kubeinfo *k8s.KubeInfo, perPhaseTimeout time.Duration, debug, dryRun bool, files ...string) error

Kubeapply applies the supplied manifests to the kubernetes cluster indicated via the kubeinfo argument. If kubeinfo is nil, it will look in the standard default places for cluster configuration. If any phase takes longer than perPhaseTimeout to become ready, then it returns early with an error.

func LoadResources

func LoadResources(ctx context.Context, path string) (result []k8s.Resource, err error)

LoadResources is like ExpandResource, but follows it up by actually parsing the YAML.

func MarshalResources

func MarshalResources(resources []k8s.Resource) ([]byte, error)

MarshalResources serializes a list of k8s.Resources in to YAML.

func Ready

func Ready(r k8s.Resource) bool

Ready returns whether or not this resource is ready; if this package does not know how to check whether the resource is ready, then it returns true.

func ReadyImplemented

func ReadyImplemented(r k8s.Resource) bool

ReadyImplemented returns whether or not this package knows how to wait for this resource to be ready.

func SaveResources

func SaveResources(path string, resources []k8s.Resource) error

SaveResources serializes a list of k8s.Resources to a YAML file.

Types

type Waiter

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

Waiter takes some YAML and waits for all of the resources described in it to be ready.

func NewWaiter

func NewWaiter(watcher *k8s.Watcher) (w *Waiter, err error)

NewWaiter constructs a Waiter object based on the supplied Watcher.

func (*Waiter) Scan

func (w *Waiter) Scan(ctx context.Context, path string) error

Scan calls LoadResources(path), and add all resources loaded to the Waiter.

func (*Waiter) Wait

func (w *Waiter) Wait(ctx context.Context, deadline time.Time) (bool, error)

Wait spews a bunch of crap on stdout, and waits for all of the Scan()ed resources to be ready. If they all become ready before deadline, then it returns true. If they don't become ready by then, then it bails early and returns false.

type YAMLCollection

type YAMLCollection map[string][]string

A YAMLCollection is a collection of YAML files to later be applied.

func CollectYAML

func CollectYAML(paths ...string) (YAMLCollection, error)

CollectYAML takes several file or directory paths, and returns a collection of the YAML files in them.

func (YAMLCollection) ApplyAndWait

func (collection YAMLCollection) ApplyAndWait(
	ctx context.Context,
	kubeinfo *k8s.KubeInfo,
	perPhaseTimeout time.Duration,
	debug, dryRun bool,
) error

ApplyAndWait applies the collection of YAML, and waits for all Resources described in it to be ready. If any phase takes longer than perPhaseTimeout to become ready, then it returns early with an error.

Jump to

Keyboard shortcuts

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