Documentation ¶
Overview ¶
Caveat:
* In this package we have global variable to define loading path.
* It means that we cannot have two separate non-loaded config files from this module.
CleanUp Interface ¶
These functions serve to just one purpose: Make YAML be compatible with JSON.
In JSON we can have map keys with only one type
string -> (map[string]interface{})
but in YAML we can use other types. So we have a problem: YAML decoder can convert some nested map as map[interface{}]interface{} and this type cannot be validated with JSON. So we need to convert all map[interface{}]interface{} -> map[string]interface{}.
Additional info about this support from gopkg.in/yaml.v3: https://github.com/go-yaml/yaml/issues/139.
Environments ¶
There are two kind of environments:
* simple - provided as string
* complex - provided as struct wih ability to override options
We use interface to hide implemenetation.
Projects ¶
There are two kind of projects:
* simple - provided as string
* complex - provided as struct wih ability to override options
We use interface to hide implemenetation.
JSON Schema ¶
Support JSON schema validation and data parsing from different formats with Conflate pkg
Index ¶
- Constants
- Variables
- func YAMLUnmarshal(data []byte, out interface{}) error
- type Config
- type CustomProcessor
- type Environment
- type EnvironmentComplex
- type EnvironmentSimple
- type File
- func (cf *File) Environments() []string
- func (cf *File) Load() (err error)
- func (cf *File) Projects() []string
- func (cf *File) ReleaseGet(name string) (*Release, error)
- func (cf *File) Releases() []*Release
- func (cf *File) Repositories() []*Repository
- func (cf *File) TargetRelease(name string, target string, targetType TargetType) (*Release, error)
- func (cf *File) TargetReleases(target string, targetType TargetType) ([]*Release, error)
- type Fragment
- type Installs
- type Project
- type ProjectComplex
- type ProjectSimple
- type Release
- type Repository
- type TargetType
- type Value
- type ValueFile
Constants ¶
const ( // Default Schema for helmctl file in JSON format ConflateJSONSchema string = `` /* 4954-byte string literal not displayed */ )
Variables ¶
var ConfigFilePath string = ""
Define global variable
var DryRun bool = false
Functions ¶
func YAMLUnmarshal ¶
YAMLUnmarshal defines YAMLUnmarshal to use yaml3 library
Types ¶
type Config ¶
type Config interface { Load() error Repositories() []*Repository Releases() []*Release TargetRelease(name string, target string, targetType TargetType) (*Release, error) TargetReleases(target string, targetType TargetType) ([]*Release, error) Environments() []string Projects() []string }
Config defines helmctl configuration.
type CustomProcessor ¶
type CustomProcessor struct {
// contains filtered or unexported fields
}
CustomProcessor is a constructor struct
func (*CustomProcessor) UnmarshalYAML ¶
func (i *CustomProcessor) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML adds additional parser to constructor
type Environment ¶
type Environment interface { GetName() string GetValues() *Release SetValues(values map[string]interface{}) error }
Environment interface type is used to hide different kind of envs
func NewEnvironmentComplex ¶
func NewEnvironmentComplex(name string) Environment
NewEnvironmentComplex return new complex env with empty values
func NewEnvironmentSimple ¶
func NewEnvironmentSimple(name string) Environment
NewEnvironmentSimple returns new simple env
type EnvironmentComplex ¶
type EnvironmentComplex struct {
// contains filtered or unexported fields
}
EnvironmentComplex complex env type
func (*EnvironmentComplex) GetName ¶
func (e *EnvironmentComplex) GetName() string
GetName returns a name of env
func (*EnvironmentComplex) GetValues ¶
func (e *EnvironmentComplex) GetValues() *Release
GetValues returns values
func (*EnvironmentComplex) SetValues ¶
func (e *EnvironmentComplex) SetValues(values map[string]interface{}) error
SetValues set values
type EnvironmentSimple ¶
type EnvironmentSimple string
EnvironmentSimple simple environment type
func (*EnvironmentSimple) GetName ¶
func (e *EnvironmentSimple) GetName() string
GetName return a name of env
func (*EnvironmentSimple) GetValues ¶
func (e *EnvironmentSimple) GetValues() *Release
GetValues returns empty values
func (*EnvironmentSimple) SetValues ¶
func (e *EnvironmentSimple) SetValues(values map[string]interface{}) error
SetValues does nothing
type File ¶
type File struct { Spec struct { Repositories []*Repository Releases []*Release Installs Installs } // contains filtered or unexported fields }
File is Config implementation.
func (*File) Environments ¶
func (*File) ReleaseGet ¶
ReleaseGet returns release object.
func (*File) Repositories ¶
func (cf *File) Repositories() []*Repository
Repositories returns list of defined repositories.
func (*File) TargetRelease ¶
TargetRelease returns releases associated to the target
func (*File) TargetReleases ¶
func (cf *File) TargetReleases(target string, targetType TargetType) ([]*Release, error)
TargetReleases returns releases associated to the target.
type Fragment ¶
type Fragment struct {
// contains filtered or unexported fields
}
Fragment is used for loading custom variables
func (*Fragment) UnmarshalYAML ¶
UnmarshalYAML adds additional processor to parser
type Installs ¶
type Installs struct { Environments map[string][]*Environment Projects map[string][]*Project }
Installs maps releases with environments and projects.
type Project ¶
type Project interface { GetName() string GetValues() *Release SetValues(values map[string]interface{}) error }
Project interface
func NewProjectComplex ¶
NewProjectComplex returns new complex project with empty values
func NewProjectSimple ¶
NewProjectSimple returns new simple project
type ProjectComplex ¶
type ProjectComplex struct {
// contains filtered or unexported fields
}
ProjectComplex complex project type
func (*ProjectComplex) GetName ¶
func (e *ProjectComplex) GetName() string
GetName returns a name of project
func (*ProjectComplex) GetValues ¶
func (e *ProjectComplex) GetValues() *Release
GetValues returns values
func (*ProjectComplex) SetValues ¶
func (e *ProjectComplex) SetValues(values map[string]interface{}) error
SetValues set alues for complex project
type ProjectSimple ¶
type ProjectSimple string
ProjectSimple simple project type
func (*ProjectSimple) GetName ¶
func (e *ProjectSimple) GetName() string
GetName returns a name of project
func (*ProjectSimple) GetValues ¶
func (e *ProjectSimple) GetValues() *Release
GetValues returns empty values
func (*ProjectSimple) SetValues ¶
func (e *ProjectSimple) SetValues(values map[string]interface{}) error
SetValues does nothing
type Release ¶
type Release struct { Name string Chart string Version string Namespace string BeforeScripts []*string AfterScripts []*string Atomic *bool Repository *Repository Values []*Value ValueFiles []*ValueFile IncludePath string }
Release represents helm release with values.
type Repository ¶
Repository represents helm repository object.
type TargetType ¶
type TargetType string
TargetType is a helm target type.
const ( TargetEnvironments TargetType = "environments" TargetProjects TargetType = "projects" )
Define target types
type Value ¶
Value represents helm value. This value will be setted via --set argument to helm.