kubernetes

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorMissingConfig means that the `spec.json` is absent
	ErrorMissingConfig = errors.New("This operation requires additional configuration. Refer to https://tanka.dev/environments for instructions")
)

Functions

func Reconcile added in v0.6.0

func Reconcile(raw map[string]interface{}, spec v1alpha1.Spec, targets []*regexp.Regexp) (state manifest.List, err error)

Reconcile extracts kubernetes Manifests from raw evaluated jsonnet <kind>/<name>, provided the manifests match the given regular expressions. It finds each manifest by recursively walking the jsonnet structure.

In addition, we sort the manifests to ensure the order is consistent in each show/diff/apply cycle. This isn't necessary, but it does help users by producing consistent diffs.

Types

type ApplyOpts

type ApplyOpts client.ApplyOpts

ApplyOpts allow set additional parameters for the apply operation

type DiffOpts added in v0.4.0

type DiffOpts struct {
	// Use `diffstat(1)` to create a histogram of the changes instead
	Summarize bool

	// Set the diff-strategy. If unset, the value set in the spec is used
	Strategy string
}

DiffOpts allow to specify additional parameters for diff operations

type Differ

type Differ func(manifest.List) (*string, error)

Differ is responsible for comparing the given manifests to the cluster and returning differences (if any) in `diff(1)` format.

func SubsetDiffer added in v0.6.0

func SubsetDiffer(c client.Client) Differ

SubsetDiffer returns a implementation of Differ that computes the diff by comparing only the fields present in the desired state. This algorithm might miss information, but is all that's possible on cluster versions lower than 1.13.

type ErrorPrimitiveReached

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

ErrorPrimitiveReached occurs when walkJSON reaches the end of nested dicts without finding a valid Kubernetes manifest

func (ErrorPrimitiveReached) Error

func (e ErrorPrimitiveReached) Error() string

type Kubernetes

type Kubernetes struct {
	Spec v1alpha1.Spec
	// contains filtered or unexported fields
}

Kubernetes exposes methods to work with the Kubernetes orchestrator

func New

func New(s v1alpha1.Spec) (*Kubernetes, error)

New creates a new Kubernetes with an initialized client

func (*Kubernetes) Apply

func (k *Kubernetes) Apply(state manifest.List, opts ApplyOpts) error

Apply receives a state object generated using `Reconcile()` and may apply it to the target system

func (*Kubernetes) Diff

func (k *Kubernetes) Diff(state manifest.List, opts DiffOpts) (*string, error)

Diff takes the desired state and returns the differences from the cluster

func (*Kubernetes) Info added in v0.6.0

func (k *Kubernetes) Info() client.Info

Info about the client, etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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