helmx

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

helmx provides an API for other golang programs to use helm-x as a library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a single file from src to dst

func DefaultRunCommand

func DefaultRunCommand(cmd string, args []string, stdout, stderr io.Writer, env map[string]string) error

func Namespace

func Namespace(ns string) *namespace

func TillerNamespace

func TillerNamespace(tillerNs string) *tillerNamespace

func TillerStorageBackend added in v0.6.0

func TillerStorageBackend(s string) *storage

func YamlMarshal

func YamlMarshal(v interface{}) ([]byte, error)

Types

type AdoptOption

type AdoptOption interface {
	SetAdoptOption(*AdoptOpts) error
}

type AdoptOpts

type AdoptOpts struct {
	*ClientOpts

	Namespace       string
	TillerNamespace string

	Out io.Writer
}

type ChartifyOption

type ChartifyOption interface {
	SetChartifyOption(opts *ChartifyOpts) error
}

func WithChartifyOpts

func WithChartifyOpts(opts *ChartifyOpts) ChartifyOption

type ChartifyOpts

type ChartifyOpts struct {
	// Debug when set to true passes `--debug` flag to `helm` in order to enable debug logging
	Debug bool

	// ValuesFiles are a list of Helm chart values files
	ValuesFiles []string

	// SetValues is a list of adhoc Helm chart values being passed via helm's `--set` flags
	SetValues []string

	// Namespace is the default namespace in which the K8s manifests rendered by the chart are associated
	Namespace string

	// ChartVersion is the semver of the Helm chart being used to render the original K8s manifests before various tweaks applied by helm-x
	ChartVersion string

	// TillerNamespace is the namespace Tiller or Helm v3 creates "release" objects(configmaps or secrets depending on the storage backend chosen)
	TillerNamespace string

	// EnableKustomizAlphaPlugins will add the `--enable_alpha_plugins` flag when running `kustomize build`
	EnableKustomizeAlphaPlugins bool

	Injectors []string
	Injects   []string

	AdhocChartDependencies []string

	JsonPatches           []string
	StrategicMergePatches []string
}

func (*ChartifyOpts) SetChartifyOption

func (s *ChartifyOpts) SetChartifyOption(opts *ChartifyOpts) error

type ClientOpts

type ClientOpts struct {
	KubeContext string
	TLS         bool
	TLSCert     string
	TLSKey      string

	TillerStorageBackend string
}

type DiffOption

type DiffOption interface {
	SetDiffOption(*DiffOpts) error
}

type DiffOpts

type DiffOpts struct {
	*ChartifyOpts
	*ClientOpts

	Chart string

	AllowUnreleased  bool
	DetailedExitcode bool
	ResetValues      bool

	Out io.Writer
	// contains filtered or unexported fields
}

func (*DiffOpts) SetDiffOption

func (s *DiffOpts) SetDiffOption(o *DiffOpts) error

type InjectOpts

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

type KustomizeBuildOption

type KustomizeBuildOption interface {
	SetKustomizeBuildOption(opts *KustomizeBuildOpts) error
}

type KustomizeBuildOpts

type KustomizeBuildOpts struct {
	ValuesFiles        []string
	SetValues          []string
	EnableAlphaPlugins bool
}

func (*KustomizeBuildOpts) SetKustomizeBuildOption

func (o *KustomizeBuildOpts) SetKustomizeBuildOption(opts *KustomizeBuildOpts) error

type KustomizeImage

type KustomizeImage struct {
	Name    string `yaml:"name"`
	NewName string `yaml:"newName"`
	NewTag  string `yaml:"newTag"`
	Digest  string `yaml:"digest"`
}

func (KustomizeImage) String

func (img KustomizeImage) String() string

type KustomizeOpts

type KustomizeOpts struct {
	Images     []KustomizeImage `yaml:"images"`
	NamePrefix string           `yaml:"namePrefix"`
	NameSuffix string           `yaml:"nameSuffix"`
	Namespace  string           `yaml:"namespace"`
}

type Option

type Option func(*Runner) error

func Commander

func Commander(c cmdsite.RunCommand) Option

type PatchOption

type PatchOption interface {
	SetPatchOption(*PatchOpts) error
}

type PatchOpts

type PatchOpts struct {
	JsonPatches []string

	StrategicMergePatches []string
}

func (*PatchOpts) SetPatchOption

func (o *PatchOpts) SetPatchOption(opts *PatchOpts) error

type RenderOpts

type RenderOpts struct {
	*ChartifyOpts

	IncludeReleaseConfigmap bool
	IncludeReleaseSecret    bool

	Out io.Writer
}

type ReplaceWithRenderedOpts

type ReplaceWithRenderedOpts struct {
	// Debug when set to true passes `--debug` flag to `helm` in order to enable debug logging
	Debug bool

	// ValuesFiles are a list of Helm chart values files
	ValuesFiles []string

	// SetValues is a list of adhoc Helm chart values being passed via helm's `--set` flags
	SetValues []string

	// Namespace is the default namespace in which the K8s manifests rendered by the chart are associated
	Namespace string

	// ChartVersion is the semver of the Helm chart being used to render the original K8s manifests before various tweaks applied by helm-x
	ChartVersion string
}

type Runner

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

func New

func New(opts ...Option) *Runner

func (*Runner) Adopt

func (r *Runner) Adopt(release string, resources []string, pathOptions *clientcmd.PathOptions, opts ...AdoptOption) error

func (*Runner) CaptureBytes

func (r *Runner) CaptureBytes(binary string, args []string) ([]byte, []byte, error)

func (*Runner) Chartify

func (r *Runner) Chartify(release, dirOrChart string, opts ...ChartifyOption) (string, error)

Chartify creates a temporary Helm chart from a directory or a remote chart, and applies various transformations. Returns the full path to the temporary directory containing the generated chart if succeeded.

Parameters: * `release` is the name of Helm release being installed

func (*Runner) DeprecatedCaptureBytes

func (r *Runner) DeprecatedCaptureBytes(cmd string) ([]byte, []byte, error)

DeprecatedCaptureBytes takes a command as a string and executes it, and returns the captured stdout and stderr

func (*Runner) DeprecatedExec

func (r *Runner) DeprecatedExec(cmd string) error

DeprecatedExec takes a command as a string and executes it

func (*Runner) Diff

func (r *Runner) Diff(release, chart string, opts ...DiffOption) (bool, error)

Diff returns true when the diff succeeds and changes are detected.

func (*Runner) Inject

func (r *Runner) Inject(files []string, o InjectOpts) error

func (*Runner) KustomizeBuild

func (r *Runner) KustomizeBuild(srcDir string, tempDir string, opts ...KustomizeBuildOption) (string, error)

func (*Runner) Patch

func (r *Runner) Patch(tempDir string, generatedManifestFiles []string, opts ...PatchOption) (string, error)

func (*Runner) Render

func (r *Runner) Render(release, chart string, templateOpts RenderOpts) error

Render generates K8s manifests for the named release from the chart, and prints the resulting manifests to STDOUT

func (*Runner) ReplaceWithRendered

func (r *Runner) ReplaceWithRendered(name, chart string, files []string, o ReplaceWithRenderedOpts) ([]string, error)

func (*Runner) Run

func (r *Runner) Run(name string, args ...string) (string, error)

func (*Runner) SearchFiles

func (r *Runner) SearchFiles(o SearchFileOpts) ([]string, error)

SearchFiles returns a slice of files that are within the base path, has a matching sub path and file type

func (*Runner) Upgrade

func (r *Runner) Upgrade(release, chart string, o UpgradeOpts) error

type SearchFileOpts

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

type UpgradeOpts

type UpgradeOpts struct {
	*ChartifyOpts
	*ClientOpts

	Timeout int
	Install bool
	DryRun  bool

	ResetValues bool

	Adopt []string

	Out io.Writer
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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