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 ¶
- func GetComponentBody(configHCL string, name string) (*hcl.Body, hcl.Diagnostics)
- func HelmActionConfig(ns string, kubeconfig []byte) (*action.Configuration, error)
- func InstallComponent(c components.Component, kubeconfig []byte) error
- func ReleaseExists(actionConfig action.Configuration, name string) (bool, error)
- func RenderChart(helmChart *chart.Chart, name, namespace, values string) (map[string]string, error)
- func RenderNodeAffinity(n []NodeAffinity) (string, error)
- func RenderResourceRequirements(r *ResourceRequirements) (string, error)
- func RenderTolerations(t []Toleration) (string, error)
- func SplitManifests(bigFile string) map[string]string
- func UninstallComponent(c components.Component, kubeconfig []byte, deleteNSBool bool) error
- type NodeAffinity
- type NodeSelector
- type ResourceList
- type ResourceRequirements
- type Toleration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetComponentBody ¶
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 ¶
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 RenderResourceRequirements ¶ added in v0.9.0
func RenderResourceRequirements(r *ResourceRequirements) (string, error)
RenderResourceRequirements takes a list of ResourceRequirements. 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 ¶
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 ¶
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 ResourceList ¶ added in v0.9.0
type ResourceList struct { CPU string `hcl:"cpu,optional" json:"cpu,omitempty"` Memory string `hcl:"memory,optional" json:"memory,omitempty"` }
ResourceList allows user to specify CPU and memory.
type ResourceRequirements ¶ added in v0.9.0
type ResourceRequirements struct { Requests *ResourceList `hcl:"requests,block" json:"requests,omitempty"` Limits *ResourceList `hcl:"limits,block" json:"limits,omitempty"` }
ResourceRequirements allows user to specify resource requests and/or limits.
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"` }