mhlib

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMHConfig = MHConfig{
	Maintainers:   []string{"none"},
	PrintRendered: false,
	Simulate:      false,
	TargetContext: "localhost",
	Team:          "sre",
	SETValues:     []string{""},
}

DefaultMHConfig is the default mh config and will most likely be modified during execution with the following sources by rising priority:

1. This default configuration 2. The "mh" key in the configuration file 3. Environment variables starting with "MH_" 4. Command line flags 5. app-specific overrides in MH_CONFIG.

Functions

This section is empty.

Types

type App

type App struct {
	AppConfig
	ID string
	// contains filtered or unexported fields
}

App contains attributes defining a mh app to run and app-specific mh configuration overrides.

func NewApp added in v0.6.0

func NewApp(logger *logrus.Entry, appConfig AppConfig, mhConfig MHConfig) (*App, error)

NewApp returns an App based on a appConfig and global MHConfig defaults.

func (*App) Apply

func (a *App) Apply(configFile string) (*[]interface{}, error)

func (*App) Build

func (a *App) Build(chart string) error

Build app's chart dependencies.

If requirements.yaml exists at app's chart, run `helm dependency build` to build dependencies at that chart's directory.

func (*App) Destroy

func (a *App) Destroy(purge bool) (*[]interface{}, error)

func (*App) Simulate

func (a *App) Simulate(configFile string) (*[]interface{}, error)

func (*App) Status

func (a *App) Status() error

type AppConfig added in v0.6.0

type AppConfig struct {
	Alias     string   `yaml:"alias"`
	File      *AppFile `yaml:"file"`
	Key       string   `yaml:"key"`
	Name      string   `yaml:"name"`
	Namespace string   `yaml:"namespace"`
	MHConfig
}

AppConfig is what can be defined in a mh configuration file and is used to create an App struct. It is a superset of MHConfig to enable app-specific configuration overrides of all mh configuration settings.

Maybe: Get rid of Alias in favor of ID

type AppConfigs added in v0.6.0

type AppConfigs []AppConfig

AppConfigs is an array of AppConfig as defined in a mh configuration file.

type AppFile added in v0.6.0

type AppFile struct {
	Path *string `yaml:"path"`
}

AppFile is represents the way to retrieve a certain mh app. It may currently only contain a Path to a file on disk.

Todo: Extend AppFile, AppSources and App.render() together with alternative sources like git or s3.

type AppFiles added in v0.6.0

type AppFiles map[string]AppFile

AppFiles is a map of app names to their respective AppFile.

type AppSource

type AppSource struct {
	AppSourceConfig
	Files AppFiles
}

AppSource contains an AppSourceConfig and all AppFiles retrieved via it.

func NewAppSource added in v0.6.0

func NewAppSource(config AppSourceConfig, configFile string) (*AppSource, error)

NewAppSource returns an AppSource based on a given AppSourceConfig and path to mh configuration(for "configPath" kind of AppSources).

Todo: Get rid of "configFile" argument in favor of defined kinds of AppSources - see AppSourceConfig.

func (*AppSource) File added in v0.6.0

func (as *AppSource) File(appConfig *AppConfig) bool

File takes an AppConfig and sets its File to the matching entry of the AppSource if one exists. Returns false if none exists.

type AppSourceConfig added in v0.6.0

type AppSourceConfig struct {
	Kind   string `yaml:"kind"`
	Name   string `yaml:"name"`
	Source string `yaml:"source"`
}

AppSourceConfig is what can be defined in a mh configuration file and is used create an AppSource struct. It defines where mh looks for app files.

Todo: Define kinds of sources here.

type AppSourceConfigs added in v0.6.0

type AppSourceConfigs []AppSourceConfig

AppSourceConfigs is an Array of AppSourceConfigs defined in a mh configuration file

type AppSources added in v0.6.0

type AppSources []AppSource

AppSources is an Array of AppSources at runtime.

func (*AppSources) File added in v0.6.0

func (as *AppSources) File(appConfig *AppConfig) bool

File calls AppSource.File on all AppSources and returns on the first match.

Todo: Add priorities in case of multiple matches.

type Apps

type Apps []App

Apps is an array of apps.

func (Apps) Apply

func (a Apps) Apply(configFile string) error

Apply runs Apply on each App

func (Apps) Destroy

func (a Apps) Destroy() error

Destroy runs Destroy on each App

func (Apps) Simulate

func (a Apps) Simulate(configFile string) error

Simulate runs Simulate on each App

type MHConfig added in v0.6.0

type MHConfig struct {
	Maintainers   []string `yaml:"maintainers"`
	PrintRendered bool     `yaml:"printRendered"`
	Simulate      bool     `yaml:"simulate"`
	TargetContext string   `yaml:"targetContext"`
	Team          string   `yaml:"team"`
	SETValues     []string
}

MHConfig is a set of options used during app deployment.

func MergeMHConfigs added in v0.6.0

func MergeMHConfigs(configs ...MHConfig) (*MHConfig, error)

MergeMHConfigs merges an arbitrary number of MHConfigs with rising priority.

type MHConfigFile added in v0.6.0

type MHConfigFile struct {
	// TargetContext for backwards compatibility
	TargetContext string           `yaml:"targetContext"`
	MH            MHConfig         `yaml:"mh"`
	Apps          AppConfigs       `yaml:"apps"`
	AppSources    AppSourceConfigs `yaml:"appSources"`
}

MHConfigFile is the structure of a mh configuration file.

func (*MHConfigFile) EffectiveApps added in v0.6.0

func (c *MHConfigFile) EffectiveApps(logger *logrus.Entry, configFile string, filters []string, effectiveMHConfig MHConfig) (*Apps, error)

EffectiveApps returns all Apps that are configured in a MHConfigFile, optionally filtering them with given expressions. It matches them against the MHConfigFiles AppSourceConfigs, if their File is not overridden. Also passes a given logger and effective MHConfig down to them.

Todo: Support more than simple names as filter. Improve the below algorithm.

Jump to

Keyboard shortcuts

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