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
- Variables
- func Apply(baseDir string, opts ApplyOpts) error
- func Delete(baseDir string, opts DeleteOpts) error
- func Diff(baseDir string, opts DiffOpts) (*string, error)
- func Eval(dir string, opts Opts) (raw interface{}, err error)
- func Format(filename string, content string) (string, error)
- func FormatFiles(fds []string, opts *FormatOpts) ([]string, error)
- func Prune(baseDir string, opts PruneOpts) error
- func Show(baseDir string, opts Opts) (manifest.List, error)
- type ApplyOpts
- type DeleteOpts
- type DiffOpts
- type FormatOpts
- type Info
- type JsonnetOpts
- type Opts
- type OutFn
- type PruneOpts
Constants ¶
const DEFAULT_DEV_VERSION = "dev"
DEFAULT_DEV_VERSION is the placeholder version used when no actual semver is provided using ldflags
Variables ¶
var CURRENT_VERSION = DEFAULT_DEV_VERSION
CURRENT_VERSION is the current version of the running Tanka code
Functions ¶
func Apply ¶
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`.
func Delete ¶ added in v0.11.0
func Delete(baseDir string, opts DeleteOpts) error
Delete parses the environment at the given directory (a `baseDir`) and deletes the generated objects from the Kubernetes cluster defined in the environment's `spec.json`.
func Diff ¶
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
Eval returns the raw evaluated Jsonnet output (without any transformations)
func Format ¶ added in v0.9.0
Format takes a file's name and contents and returns them in properly formatted. The file does not have to exist on disk.
func FormatFiles ¶ added in v0.9.0
func FormatFiles(fds []string, opts *FormatOpts) ([]string, error)
FormatFiles takes a list of files and directories, processes them and returns which files were formatted and perhaps an error.
Types ¶
type ApplyOpts ¶ added in v0.12.0
type ApplyOpts struct { Opts // AutoApprove skips the interactive approval AutoApprove bool // DiffStrategy to use for printing the diff before approval DiffStrategy string // Force ignores any warnings kubectl might have Force bool // Validate set to false ignores invalid Kubernetes schemas Validate bool }
ApplyOpts specify additional properties for the Apply action
type DeleteOpts ¶ added in v0.12.0
type DeleteOpts struct { Opts // AutoApprove skips the interactive approval AutoApprove bool // Force ignores any warnings kubectl might have Force bool // Validate set to false ignores invalid Kubernetes schemas Validate bool }
DeleteOpts specify additional properties for the Delete operation
type DiffOpts ¶ added in v0.12.0
type DiffOpts struct { Opts // Strategy must be one of "native" or "subset" Strategy string // Summarize prints a summary, instead of the actual diff Summarize bool }
DiffOpts specify additional properties for the Diff action
type FormatOpts ¶ added in v0.9.0
type FormatOpts struct { // Excludes are a list of globs to exclude files while searching for Jsonnet // files Excludes []glob.Glob // OutFn receives the formatted file and it's name. If left nil, the file // will be formatted in place. OutFn OutFn // PrintNames causes all filenames to be printed PrintNames bool }
FormatOpts modify the behaviour of Format
type 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.
type JsonnetOpts ¶ added in v0.12.0
type Opts ¶ added in v0.12.0
type Opts struct { JsonnetOpts // Filters are used to optionally select a subset of the resources Filters process.Matchers }
Opts specify general, optional properties that apply to all actions