util

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package util package has helper functions for installing/deleting/templatising a helm chart. It also contains the reused component configuration type like NodeSelectors, Taints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComponentBody

func GetComponentBody(configHCL string, name string) (*hcl.Body, hcl.Diagnostics)

GetComponentBody parses a string containing a component configuration in HCL and returns its body. Currently only the body of the first component is returned.

func HelmActionConfig added in v0.1.0

func HelmActionConfig(ns string, kubeconfig []byte) (*action.Configuration, error)

HelmActionConfig creates initialized Helm action configuration.

func InstallComponent

func InstallComponent(c components.Component, kubeconfig []byte) error

InstallComponent installs given component using given kubeconfig as a Helm release using a Helm client. Before installing the component, the release namespace is created/updated.

func ReleaseExists added in v0.1.0

func ReleaseExists(actionConfig action.Configuration, name string) (bool, error)

ReleaseExists checks if given Helm release exists.

func RenderChart

func RenderChart(helmChart *chart.Chart, name, namespace, values string) (map[string]string, error)

RenderChart renders a Helm chart with the given name, namespace and values and either returns a map of manifest files or an error.

func RenderNodeAffinity added in v0.2.0

func RenderNodeAffinity(n []NodeAffinity) (string, error)

RenderNodeAffinity takes a list of NodeAffinity. It returns a json string and an error if any.

func RenderTolerations

func RenderTolerations(t []Toleration) (string, error)

RenderTolerations takes a list of tolerations. It returns a json string and an error if any.

func SplitManifests

func SplitManifests(bigFile string) map[string]string

SplitManifests splits a YAML manifest into smaller YAML manifest. Name is read from the Source: <filename> annotation in https://github.com/helm/helm/blob/456eb7f4118a635427bd43daa3d7aabf29304f13/pkg/action/install.go#L468.

func UninstallComponent added in v0.4.0

func UninstallComponent(c components.Component, kubeconfig []byte, deleteNSBool bool) error

UninstallComponent uninstalls a component and optionally removes it's namespace.

Types

type NodeAffinity added in v0.2.0

type NodeAffinity struct {
	Key      string   `hcl:"key" json:"key,omitempty"`
	Operator string   `hcl:"operator" json:"operator,omitempty"`
	Values   []string `hcl:"values,optional" json:"values,omitempty"`
}

NodeAffinity is a struct that other components can use to define the HCL format of NodeAffinity in Kubernetes PodSpec.

type NodeSelector

type NodeSelector map[string]string

NodeSelector is a type used when defining node selector for the pod spec.

func (*NodeSelector) Render added in v0.2.0

func (n *NodeSelector) Render() (string, error)

Render renders NodeSelector into a json string.

type Toleration

type Toleration struct {
	Key               string `hcl:"key,optional" json:"key,omitempty"`
	Effect            string `hcl:"effect,optional" json:"effect,omitempty"`
	Operator          string `hcl:"operator,optional" json:"operator,omitempty"`
	Value             string `hcl:"value,optional" json:"value,omitempty"`
	TolerationSeconds int64  `hcl:"toleration_seconds,optional" json:"tolerationSeconds,omitempty"`
}

Jump to

Keyboard shortcuts

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