Back to

Package landscaper

Latest Go to latest

The highest tagged major version is .

Published: Jul 12, 2019 | License: Apache-2.0 | Module:



var (
	// ErrNonLandscapeComponent is an error to indicate a release is not controlled by landscaper
	ErrNonLandscapeComponent = errors.New("release is not controlled by landscaper")

	// ErrInvalidLandscapeMetadata is an error to indicate a release contains invalid landscaper metadata
	ErrInvalidLandscapeMetadata = errors.New("release contains invalid landscaper metadata")
var (
	SemVer    = "-"
	GitCommit = "-"
	GitTag    = "-"

plugged in during build

type ChartLoader

type ChartLoader interface {
	Load(chartRef string) (*chart.Chart, string, error)

ChartLoader allows one to load Charts by name

type Component

type Component struct {
	Name          string         `json:"name" validate:"nonzero,max=51"`
	Namespace     string         `json:"namespace"`
	Release       *Release       `json:"release" validate:"nonzero"`
	Configuration Configuration  `json:"configuration"`
	Environments  Configurations `json:"environments"`
	SecretsRaw    interface{}    `json:"secrets"`
	SecretNames   SecretNames    `json:"-"`
	SecretValues  SecretValues   `json:"-"`

Component contains information about the release, configuration and secrets of a component

func NewComponent

func NewComponent(name string, namespace string, release *Release, cfg Configuration, envs Configurations, secretNames SecretNames) *Component

NewComponent creates a Component and adds Name to the configuration

func (*Component) Equals

func (c *Component) Equals(other *Component) bool

Equals checks if this component's values are equal to another

func (*Component) FullChartRef

func (c *Component) FullChartRef() (string, error)

FullChartRef provides a chart references like "myRepo/chartName"

func (*Component) Validate

func (c *Component) Validate() error

Validate the component on required fields and correct values

type Components

type Components map[string]*Component

Components is a collection of uniquely named Component objects

type Configuration

type Configuration map[string]interface{}

Configuration contains all the values that should be applied to the component's helm package release

func (Configuration) GetMetadata

func (cfg Configuration) GetMetadata() (*Metadata, error)

GetMetadata returns a Metadata if present

func (Configuration) HasMetadata

func (cfg Configuration) HasMetadata() bool

HasMetadata returns true if the config contains a landscaper metadata structure

func (Configuration) Merge

func (cfg Configuration) Merge(src Configuration) Configuration

Merge two configurations

func (Configuration) SetMetadata

func (cfg Configuration) SetMetadata(m *Metadata)

SetMetadata sets the provided Metadata

func (Configuration) YAML

func (cfg Configuration) YAML() (string, error)

YAML encodes the Values into a YAML string.

type Configurations

type Configurations map[string]Configuration

Configurations are a list of environment specific configuration overrides

type Environment

type Environment struct {
	HelmHome                  string        // Helm's home directory
	DryRun                    bool          // If true, don't modify anything
	Wait                      bool          // Wait until all resources become ready
	WaitTimeout               time.Duration // Wait for helm
	ChartLoader               ChartLoader   // ChartLoader loads charts
	ReleaseNamePrefix         string        // Prepend this string to release names
	ComponentFiles            []string      // Landscaper component file names
	LandscapeDir              string        // deprecated: ComponentFiles is leading; LandscapeDir merely fills it
	Namespace                 string        // Default namespace releases are put into; components can override it though
	Verbose                   bool          // Reduce log level
	Context                   string        // Kubernetes context to use
	Loop                      bool          // Keep looping
	LoopInterval              time.Duration // Loop every duration
	TillerNamespace           string        // where to install / use tiller
	AzureKeyVault             string        // Azure keyvault to use for secrets if provided
	Environment               string        // Environment selections
	ConfigurationOverrideFile string        // Global configuration overrides file

	DisabledStages stringSlice // stages to disable during landscaper apply
	// contains filtered or unexported fields

Environment contains all the information about the k8s cluster and local configuration

func (*Environment) HelmClient

func (e *Environment) HelmClient() helm.Interface

HelmClient makes sure the environment has a HelmClient initialized and returns it

func (*Environment) KubeClient

func (e *Environment) KubeClient() internalversion.CoreInterface

KubeClient makes sure the environment has a KubeClient initialized

func (*Environment) Teardown

func (e *Environment) Teardown()

Teardown closes the tunnel

type Executor

type Executor interface {
	Apply(Components, Components) (map[string][]string, error)

	CreateComponent(*Component) error
	UpdateComponent(*Component) error
	DeleteComponent(*Component) error

Executor is responsible for applying a desired landscape to the actual landscape

func NewExecutor

func NewExecutor(helmClient helm.Interface, chartLoader ChartLoader, kubeSecrets SecretsWriteDeleter, dryRun bool, wait bool, waitTimeout int64, disabledStages []string) Executor

NewExecutor is a factory method to create a new Executor

type LocalCharts

type LocalCharts struct {
	HomePath string

LocalCharts allows one to load Charts from a local path

func NewLocalCharts

func NewLocalCharts(homePath string) *LocalCharts

NewLocalCharts creates a LocalCharts ChartLoader

func (*LocalCharts) Load

func (c *LocalCharts) Load(chartRef string) (*chart.Chart, string, error)

Load locates, and potentially downloads, a chart to the local repository

type Metadata

type Metadata struct {
	ReleaseVersion  string
	ChartRepository string

Metadata holds landscaper metadata that is attached to a component/release through its Configuration

type Release

type Release struct {
	Chart   string `json:"chart" validate:"nonzero"` // TODO: write a regexp validation for the chart
	Version string `json:"version"`

Release contains the information of a component release

type SecretNames

type SecretNames map[string]string

SecretNames is a map containing the name of the secrets and a reference to get their value from the secrets provider.

type SecretValues

type SecretValues map[string][]byte

SecretValues is a map containing the actual values of the secrets. Note that this should not be written to kubernetes or anywhere else persistent!

type SecretsReadWriteDeleter

type SecretsReadWriteDeleter interface {

SecretsReadWriteDeleter allows reading, writing and deleting secrets

func NewKubeSecretsReadWriteDeleter

func NewKubeSecretsReadWriteDeleter(kubeClient internalversion.CoreInterface) SecretsReadWriteDeleter

NewKubeSecretsReadWriteDeleter create a new SecretsReadWriteDeleter for kubernetes secrets

type SecretsReader

type SecretsReader interface {
	Read(componentName, namespace string, secretNames SecretNames) (SecretValues, error)

SecretsReader allows reading secrets

func NewAzureSecretsReader

func NewAzureSecretsReader(keyVault string) (SecretsReader, error)

NewAzureSecretsReader creates a SecretsReader that fetches secrets from an Azure KeyVault

func NewEnvironmentSecretsReader

func NewEnvironmentSecretsReader() SecretsReader

NewEnvironmentSecretsReader creates a SecretsReader for secrets provided via environment variables

type SecretsWriteDeleter

type SecretsWriteDeleter interface {
	Write(componentName, namespace string, secretValues SecretValues) error
	Delete(componentName, namespace string) error

SecretsWriteDeleter allows writing and deleting secrets

type StateProvider

type StateProvider interface {
	Components() (Components, error)

StateProvider can be used to obtain a state, actual (from Helm) or desired (e.g. from files)

func NewFileStateProvider

func NewFileStateProvider(fileNames []string, secrets SecretsReader, chartLoader ChartLoader, releaseNamePrefix, namespace string, environment string, configurationOverrideFile string) StateProvider

NewFileStateProvider creates a StateProvider that sources Files

func NewHelmStateProvider

func NewHelmStateProvider(helmClient helm.Interface, secrets SecretsReader, releaseNamePrefix string) StateProvider

NewHelmStateProvider creates a StateProvider that sources Helm (actual state)

type Version

type Version struct {
	SemVer    string
	GitCommit string
	GitTag    string

Version contains versioning information obtained during build

func GetVersion

func GetVersion() Version

GetVersion provides the landscaper version and build information

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier