apply

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResultsTextTable

func ResultsTextTable(results []Result) string

ResultsTextTable returns a pretty table that summarizes the results of a kubectl apply run.

Types

type KubeMetadata

type KubeMetadata struct {
	Name              string `json:"name"`
	Namespace         string `json:"namespace"`
	ResourceVersion   string `json:"resourceVersion"`
	CreationTimestamp string `json:"creationTimestamp"`
}

KubeMetadata is basic metadata about an object or list.

type Result

type Result struct {
	Name       string
	Namespace  string
	Kind       string
	CreatedAt  time.Time
	OldVersion string
	NewVersion string
	// contains filtered or unexported fields
}

Result represents the result of running "kubectl apply" for a single manifest.

func ObjsToResults

func ObjsToResults(
	oldObjs []TypedKubeObj,
	newObjs []TypedKubeObj,
) ([]Result, error)

ObjsToResults diffs old and new object slices to generate a slice of apply results for display to the user.

func (Result) CreatedTimestamp

func (r Result) CreatedTimestamp() string

CreatedTimestamp returns the creation time of the resource associated with this result.

func (Result) IsCreated

func (r Result) IsCreated() bool

IsCreated returns whether this result involved a resource creation.

func (Result) IsUpdated

func (r Result) IsUpdated() bool

IsUpdated returns whether this result involved updating an existing resource.

type TypedKubeObj

type TypedKubeObj struct {
	APIVersion   string `json:"apiVersion"`
	Kind         string `json:"kind"`
	KubeMetadata `json:"metadata"`
	Items        []TypedKubeObj `json:"items"`
}

TypedKubeObj is a typed object that is returned by the kube API. We're using this instead of the formal types from the kube API because it's more flexible and doesn't require registering all types in a scheme, etc.

func KubeJSONToObjects

func KubeJSONToObjects(contents []byte) ([]TypedKubeObj, error)

KubeJSONToObjects converts the results of "kubectl apply ... -o json" into a slice of Kubernetes objects.

type TypedObj

type TypedObj interface {
	metav1.Object
	runtime.Object
}

TypedObj is an interface used for extracting metadata from Kubernetes objects.

Jump to

Keyboard shortcuts

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