boondoggle

package
v3.0.10 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Reset  = "\033[0m"
	Bold   = "\033[1m"
	Red    = "\033[31m"
	Green  = "\033[32m"
	Yellow = "\033[33m"
	Blue   = "\033[34m"
	Purple = "\033[35m"
	Cyan   = "\033[36m"
	Gray   = "\033[37m"
	White  = "\033[97m"
)

Functions

func Format added in v3.0.10

func Format(color, message string) string

Format wraps a given message in a given color, and obfuscates some sensitive output.

func WriteRequirements

func WriteRequirements(r Requirements, b Boondoggle) error

WriteRequirements writes the dependencies to eithe chart.yaml or requirements.yaml depending on the version of helm you are running

Types

type Boondoggle

type Boondoggle struct {
	PullSecretsName string
	DockerUsername  string
	DockerPassword  string
	DockerEmail     string
	HelmVersion     int
	HelmRepos       []HelmRepo
	Umbrella        Umbrella
	Services        []Service
	ExtraEnv        map[string]string
	L               LogPrinter
	Verbose         bool
	SuperSecret     bool
}

Boondoggle is the processed version of RawBoondoggle. It represents the settings of only the chosen options.

func NewBoondoggle

func NewBoondoggle(config RawBoondoggle, environment string, setStateAll string, serviceState []string, extraEnv map[string]string, logger LogPrinter, verbose bool, superSecret bool) Boondoggle

NewBoondoggle unmarshals the boondoggle.yml to RawBoondoggle and returns a processed Boondoggle struct type.

func (*Boondoggle) AddHelmRepos

func (b *Boondoggle) AddHelmRepos() error

AddHelmRepos uses `helm repo add` to setup the repos listed in boondoggle config. If promtbasicauth is true, it will prompt the user for the helm repo username and password. If "username" and "password" are provided, it will use these as the basic auth username and password. environment var replacement is supported for these. If the result for the environment variable lookup is empty, it will fall back to prompting for username and password. It will not do anything if the repo is already added.

func (*Boondoggle) AddImagePullSecret

func (b *Boondoggle) AddImagePullSecret(namespace string) error

AddImagePullSecret ensures the kubernetes imagePullSecret is set with kubectl.

func (*Boondoggle) CreateNamespaceIfNotExists added in v3.0.4

func (b *Boondoggle) CreateNamespaceIfNotExists(namespace string) error

CreateNamespaceIfNotExists creates a kubernetes namespace if it does not already exist in the cluster.

func (*Boondoggle) DepUp

func (b *Boondoggle) DepUp() error

DepUp runs "helm dependency update".

func (*Boondoggle) DoBuild

func (b *Boondoggle) DoBuild() error

DoBuild builds the localdev container based on the command in the boondoggle config file.

func (*Boondoggle) DoPostDeployExec

func (b *Boondoggle) DoPostDeployExec(namespace string) error

DoPostDeployExec runs commands in the app outlined in the boondoggle.yml file for the services with the state set to "localdev"

func (*Boondoggle) DoPostDeploySteps

func (b *Boondoggle) DoPostDeploySteps() error

DoPostDeploySteps runs the postDeploySteps outlined in the boondoggle.yml file for the services with the state set to "localdev" This is used for building any steps that need to happen after deploying a local environment.

func (*Boondoggle) DoPreDeploySteps

func (b *Boondoggle) DoPreDeploySteps() error

DoPreDeploySteps runs the preDeploySteps outlined in the boondoggle.yml file for the services with the state set to "localdev" This is used for building any steps that need to happen before deploying a local environment.

func (*Boondoggle) DoUpgrade

func (b *Boondoggle) DoUpgrade(namespace string, release string, dryRun bool, useSecrets bool, tls bool, tillerNamespace string) ([]byte, error)

DoUpgrade builds and runs the helm upgrade --install command.

func (*Boondoggle) SelfFetch

func (b *Boondoggle) SelfFetch(path string, version string) error

SelfFetch will fetch the umbrella chart listed in the boondoggle.yml file.

type Chart

type Chart struct {
	Name         string            `yaml:"name,omitempty"`
	Home         string            `yaml:"home,omitempty"`
	Sources      []string          `yaml:"sources,omitempty"`
	Version      string            `yaml:"version,omitempty"`
	Description  string            `yaml:"description,omitempty"`
	Keywords     []string          `yaml:"keywords,omitempty"`
	Maintainers  []Maintainer      `yaml:"maintainers,omitempty"`
	Icon         string            `yaml:"icon,omitempty"`
	APIVersion   string            `yaml:"apiVersion,omitempty"`
	Condition    string            `yaml:"condition,omitempty"`
	Tags         string            `yaml:"tags,omitempty"`
	AppVersion   string            `yaml:"appVersion,omitempty"`
	Deprecated   bool              `yaml:"deprecated,omitempty"`
	Annotations  map[string]string `yaml:"annotations,omitempty"`
	KubeVersion  string            `yaml:"kubeVersion,omitempty"`
	Dependencies []Dependency      `yaml:"dependencies,omitempty"`
	Type         string            `yaml:"type,omitempty"`
}

Chart for a Chart file. This models the structure of a Chart.yaml file.

type Dependency

type Dependency struct {
	Name         string        `yaml:"name,omitempty"`
	Version      string        `yaml:"version,omitempty"`
	Repository   string        `yaml:"repository,omitempty"`
	Condition    string        `yaml:"condition,omitempty"`
	Tags         []string      `yaml:"tags,omitempty"`
	Enabled      bool          `yaml:"enabled,omitempty"`
	Importvalues []interface{} `yaml:"importvalues,omitempty"`
	Alias        string        `yaml:"alias,omitempty"`
}

Dependency is part of the requirements file

type HelmRepo

type HelmRepo struct {
	Name            string
	URL             string
	Promptbasicauth bool
	Username        string
	Password        string
}

HelmRepo is the data needed to add a Helm Repository. Part of Boondoggle struct.

type LogPrinter added in v3.0.4

type LogPrinter interface {
	Print(...interface{})
}

type Maintainer

type Maintainer struct {
	// Name is a user name or organization name
	Name string `yaml:"name,omitempty"`
	// Email is an optional email address to contact the named maintainer
	Email string `yaml:"email,omitempty"`
	// URL is an optional URL to an address for the named maintainer
	URL string `yaml:"url,omitempty"`
}

Maintainer describes a Chart maintainer.

type RawBoondoggle

type RawBoondoggle struct {
	HelmVersion     int    `mapstructure:"helmVersion,omitempty"`
	PullSecretsName string `mapstructure:"pull-secrets-name,omitempty"`
	DockerUsername  string `mapstructure:"docker_username,omitempty"`
	DockerPassword  string `mapstructure:"docker_password,omitempty"`
	DockerEmail     string `mapstructure:"docker_email,omitempty"`
	HelmRepos       []struct {
		Name            string `mapstructure:"name"`
		URL             string `mapstructure:"url"`
		Promptbasicauth bool   `mapstructure:"promptbasicauth,omitempty"`
		Username        string `mapstructure:"username,omitempty"`
		Password        string `mapstructure:"password,omitempty"`
	} `mapstructure:"helm-repos"`
	Umbrella struct {
		Name         string `mapstructure:"name"`
		Repository   string `mapstructure:"repository"`
		Path         string `mapstructure:"path"`
		Environments []struct {
			Name           string   `mapstructure:"name"`
			Files          []string `mapstructure:"files,omitempty"`
			Values         []string `mapstructure:"values,omitempty"`
			AddtlHelmFlags []string `mapstructure:"addtlHelmFlags,omitempty"`
		} `mapstructure:"environments"`
	} `mapstructure:"umbrella"`
	Services []struct {
		Name               string `mapstructure:"name"`
		Path               string `mapstructure:"path"`
		Gitrepo            string `mapstructure:"gitrepo"`
		Alias              string `mapstructure:"alias,omitempty"`
		Chart              string `mapstructure:"chart"`
		DepValuesAllStates struct {
			Condition    string        `mapstructure:"condition,omitempty"`
			Tags         []string      `mapstructure:"tags,omitempty"`
			Enabled      bool          `mapstructure:"enabled,omitempty"`
			Importvalues []interface{} `mapstructure:"importvalues,omitempty"`
		} `mapstructure:"dep-values-all-states,omitempty"`
		States []struct {
			StateName      string        `mapstructure:"state-name"`
			ContainerBuild string        `mapstructure:"container-build,omitempty"`
			Repository     string        `mapstructure:"repository"`
			HelmValues     []string      `mapstructure:"helm-values,omitempty"`
			Version        string        `mapstructure:"version"`
			Condition      string        `mapstructure:"condition,omitempty"`
			Tags           []string      `mapstructure:"tags,omitempty"`
			Enabled        bool          `mapstructure:"enabled,omitempty"`
			Importvalues   []interface{} `mapstructure:"importvalues,omitempty"`
			PreDeploySteps []struct {
				Cmd  string   `mapstructure:"cmd,omitempty"`
				Args []string `mapstructure:"args,omitempty"`
			} `mapstructure:"preDeploySteps,omitempty"`
			PostDeploySteps []struct {
				Cmd  string   `mapstructure:"cmd,omitempty"`
				Args []string `mapstructure:"args,omitempty"`
			} `mapstructure:"postDeploySteps,omitempty"`
			PostDeployExec []struct {
				App       string   `mapstructure:"app,omitempty"`
				Container string   `mapstructure:"container,omitempty"`
				Args      []string `mapstructure:"args,omitempty"`
			} `mapstructure:"postDeployExec,omitempty"`
		} `mapstructure:"states"`
	} `mapstructure:"services"`
}

RawBoondoggle is the struct representation of the boondoggle.yml config file.

type Requirements

type Requirements struct {
	Dependencies []Dependency `yaml:"dependencies"`
}

Requirements represents the yaml file requirements.yaml as used in a Helm chart.

func BuildRequirements

func BuildRequirements(b Boondoggle, svo []string) Requirements

BuildRequirements converts a Boondoggle into a Helm Requirements struct.

type Service

type Service struct {
	Name            string
	Path            string
	Gitrepo         string
	Alias           string
	Chart           string
	ContainerBuild  string
	Repository      string
	HelmValues      []string
	Version         string
	Condition       string
	Tags            []string
	Enabled         bool
	Importvalues    []interface{}
	PreDeploySteps  []Step
	PostDeploySteps []Step
	PostDeployExec  []Step
}

Service is the definition of a service (an umbrella dependency). Part of Boondoggle struct.

func (Service) GetHelmDepName

func (s Service) GetHelmDepName() string

GetHelmDepName is a helper to return the Alias if there is one, else returns Chart

type Step

type Step struct {
	App       string
	Container string
	Cmd       string
	Args      []string
}

Step contains instructions for a pre, post or post exec build step for local.

type Umbrella

type Umbrella struct {
	Name           string
	Path           string
	Repository     string
	Files          []string
	Values         []string
	AddtlHelmFlags []string
}

Umbrella is the definition of a Helm Umbrella chart. Part of Boondoggle struct.

Jump to

Keyboard shortcuts

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