tanka

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

Package tanka allows to use most of Tanka's features available on the command line programmatically as a Golang library. Keep in mind that the API is still experimental and may change without and signs of warnings while Tanka is still in alpha. Nevertheless, we try to avoid breaking changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(baseDir string, mods ...Modifier) error

Apply parses the environment at the given directory (a `baseDir`) and applies the evaluated jsonnet to the Kubernetes cluster defined in the environments `spec.json`. NOTE: This function prints on screen in default configuration. Use the `WithWarnWriter` modifier to change that. The `WithApply*` modifiers may be used to further influence the behavior.

func Diff

func Diff(baseDir string, mods ...Modifier) (*string, error)

Diff parses the environment at the given directory (a `baseDir`) and returns the differences from the live cluster state in `diff(1)` format. If the `WithDiffSummarize` modifier is used, a histogram created using `diffstat(1)` is returned instead. The cluster information is retrieved from the environments `spec.json`. NOTE: This function requires on `diff(1)`, `kubectl(1)` and perhaps `diffstat(1)`

func Eval added in v0.7.0

func Eval(dir string, mods ...Modifier) (raw map[string]interface{}, err error)

Eval returns the raw evaluated Jsonnet output (without any transformations)

func Show

func Show(baseDir string, mods ...Modifier) (manifest.List, error)

Show parses the environment at the given directory (a `baseDir`) and returns the list of Kubernetes objects. Tip: use the `String()` function on the returned list to get the familiar yaml stream

Types

type Info

type Info struct {
	Env       *v1alpha1.Config
	Resources manifest.List
	Client    client.Info
}

Info holds information about a particular environment, including its Config, the individual resources of the desired state and also the status of the client.

func Status

func Status(baseDir string, mods ...Modifier) (*Info, error)

Status returns information about the particular environment

type Modifier

type Modifier func(*options)

Modifier allow to influence the behavior of certain `tanka.*` actions. They are roughly equivalent to flags on the command line. See the `tanka.With*` functions for available options.

func WithApplyAutoApprove

func WithApplyAutoApprove(b bool) Modifier

WithApplyAutoApprove allows to skip the interactive approval

func WithApplyForce

func WithApplyForce(b bool) Modifier

WithApplyForce allows to invoke `kubectl apply` with the `--force` flag

func WithApplyValidate added in v0.7.1

func WithApplyValidate(b bool) Modifier

WithApplyValidate allows to invoke `kubectl apply` with the `--validate=false` flag

func WithDiffStrategy

func WithDiffStrategy(ds string) Modifier

WithDiffStrategy allows to set the used diff strategy. An empty string is ignored.

func WithDiffSummarize

func WithDiffSummarize(b bool) Modifier

WithDiffSummarize enables summary mode, which invokes `diffstat(1)` on the set of changes to create an overview

func WithExtCode added in v0.7.0

func WithExtCode(code map[string]string) Modifier

WithExtCode allows to pass external variables (jsonnet code) to the VM

func WithTargets

func WithTargets(t ...*regexp.Regexp) Modifier

WithTargets allows to submit regular expressions to limit the working set of objects (https://tanka.dev/output-filtering/).

type ParseResult

type ParseResult struct {
	Env       *v1alpha1.Config
	Resources manifest.List
}

ParseResult contains the environments config and the manifests of this particular env

Jump to

Keyboard shortcuts

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