helmify

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 8 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetadata added in v0.3.0

type AppMetadata interface {
	// Namespace returns app namespace.
	Namespace() string
	// ChartName returns chart name
	ChartName() string
	// TemplatedName converts object name to templated Helm name.
	// Example: 	"my-app-service1"	-> "{{ include "chart.fullname" . }}-service1"
	//				"my-app-secret"		-> "{{ include "chart.fullname" . }}-secret"
	//				etc...
	TemplatedName(objName string) string
	// TemplatedString converts a string to templated string with chart name.
	TemplatedString(str string) string
	// TrimName trims common prefix from object name if exists.
	// We trim common prefix because helm already using release for this purpose.
	TrimName(objName string) string

	Config() config.Config
}

AppMetadata handle common information about K8s objects in the chart.

type Output

type Output interface {
	Create(chartName, chartDir string, Crd bool, certManagerAsSubchart bool, certManagerVersion string, certManagerInstallCRD bool, templates []Template, filenames []string) error
}

Output - converts Template into helm chart on disk.

type Processor

type Processor interface {
	// Process - converts k8s object to Helm template.
	// return false if not able to process given object type.
	Process(appMeta AppMetadata, unstructured *unstructured.Unstructured) (bool, Template, error)
}

Processor - converts k8s object to helm template. Implement this interface and register it to a context to support a new k8s resource conversion.

type Template

type Template interface {
	// Filename - returns template filename
	Filename() string
	// Values - returns set of values used in template
	Values() Values
	// Write - writes helm template into given writer
	Write(writer io.Writer) error
}

Template - represents Helm template in 'templates' directory.

type Values

type Values map[string]interface{}

Values - represents helm template values.yaml.

func (*Values) Add added in v0.3.0

func (v *Values) Add(value interface{}, name ...string) (string, error)

Add - adds given value to values and returns its helm template representation {{ .Values.<valueName> }}

func (*Values) AddSecret added in v0.3.1

func (v *Values) AddSecret(toBase64 bool, name ...string) (string, error)

AddSecret - adds empty value to values and returns its helm template representation {{ required "<valueName>" .Values.<valueName> }}. Set toBase64=true for Secret data to be base64 encoded and set false for Secret stringData.

func (*Values) AddYaml added in v0.3.31

func (v *Values) AddYaml(value interface{}, indent int, newLine bool, name ...string) (string, error)

AddYaml - adds given value to values and returns its helm template representation as Yaml {{ .Values.<valueName> | toYaml | indent i }} indent <= 0 will be omitted.

func (*Values) Merge

func (v *Values) Merge(values Values) error

Merge given values with current instance.

Jump to

Keyboard shortcuts

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