Documentation ¶
Index ¶
- type AppMetadata
- type Output
- type Processor
- type Template
- type Values
- func (v *Values) Add(config ast.Expr, value interface{}, description string, name ...string) (string, error)
- func (v *Values) AddConfig(config ast.Expr, description string, required bool, name ...string) error
- func (v *Values) AddSecret(toBase64 bool, name ...string) (string, error)
- func (v *Values) AddYaml(value interface{}, indent int, newLine bool, name ...string) (string, error)
- func (v *Values) Merge(values *Values) error
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 // ModuleName returns module name ModuleName() string // TemplatedName converts object name to templated Helm name. // Example: "my-app-service1" -> "{{ include "module.fullname" . }}-service1" // "my-app-secret" -> "{{ include "module.fullname" . }}-secret" // etc... TemplatedName(objName string) string // TemplatedString converts a string to templated string with module 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 module.
type Output ¶
type Output interface {
Create(moduleName, moduleDir string, Crd bool, templates []Template, filenames []string) error
}
Output - converts Template into helm module 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 // ObjectType - object type for config.cue file ObjectType() ast.Expr // ObjectLabel - object label for config.cue file ObjectLabel() ast.Label }
Template - represents Helm template in 'templates' directory.
type Values ¶
type Values struct { // Config represents values for config.cue file. Config *ast.StructLit // Values represents values for values.cue file. Values map[string]interface{} // Descriptions represents description for values. Descriptions map[string]string }
Values - represents timoni values.
func (*Values) Add ¶
func (v *Values) Add(config ast.Expr, value interface{}, description string, name ...string) (string, error)
Add - adds given value to values and returns its timoni representation #config.<valueName>
func (*Values) AddSecret ¶
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.