helmify

package
v0.0.0-...-17737f7 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetadata

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, templates []Template) 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

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

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) 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