landscaper: github.com/Eneco/landscaper/pkg/landscaper Index | Files

package landscaper

import "github.com/Eneco/landscaper/pkg/landscaper"

Index

Package Files

chart.go component.go configuration.go environment.go executor.go metadata.go release.go secrets.go secrets_azure.go state_provider.go version.go

Variables

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 Uses

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

ChartLoader allows one to load Charts by name

type Component Uses

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 Uses

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 Uses

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

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

func (*Component) FullChartRef Uses

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

FullChartRef provides a chart references like "myRepo/chartName"

func (*Component) Validate Uses

func (c *Component) Validate() error

Validate the component on required fields and correct values

type Components Uses

type Components map[string]*Component

Components is a collection of uniquely named Component objects

type Configuration Uses

type Configuration map[string]interface{}

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

func (Configuration) GetMetadata Uses

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

GetMetadata returns a Metadata if present

func (Configuration) HasMetadata Uses

func (cfg Configuration) HasMetadata() bool

HasMetadata returns true if the config contains a landscaper metadata structure

func (Configuration) Merge Uses

func (cfg Configuration) Merge(src Configuration) Configuration

Merge two configurations

func (Configuration) SetMetadata Uses

func (cfg Configuration) SetMetadata(m *Metadata)

SetMetadata sets the provided Metadata

func (Configuration) YAML Uses

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

YAML encodes the Values into a YAML string.

type Configurations Uses

type Configurations map[string]Configuration

Configurations are a list of environment specific configuration overrides

type Environment Uses

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 Uses

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

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

func (*Environment) KubeClient Uses

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

KubeClient makes sure the environment has a KubeClient initialized

func (*Environment) Teardown Uses

func (e *Environment) Teardown()

Teardown closes the tunnel

type Executor Uses

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 Uses

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 Uses

type LocalCharts struct {
    HomePath string
}

LocalCharts allows one to load Charts from a local path

func NewLocalCharts Uses

func NewLocalCharts(homePath string) *LocalCharts

NewLocalCharts creates a LocalCharts ChartLoader

func (*LocalCharts) Load Uses

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

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

type Metadata Uses

type Metadata struct {
    ReleaseVersion  string
    ChartRepository string
}

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

type Release Uses

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 Uses

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 Uses

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 Uses

type SecretsReadWriteDeleter interface {
    SecretsReader
    SecretsWriteDeleter
}

SecretsReadWriteDeleter allows reading, writing and deleting secrets

func NewKubeSecretsReadWriteDeleter Uses

func NewKubeSecretsReadWriteDeleter(kubeClient internalversion.CoreInterface) SecretsReadWriteDeleter

NewKubeSecretsReadWriteDeleter create a new SecretsReadWriteDeleter for kubernetes secrets

type SecretsReader Uses

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

SecretsReader allows reading secrets

func NewAzureSecretsReader Uses

func NewAzureSecretsReader(keyVault string) (SecretsReader, error)

NewAzureSecretsReader creates a SecretsReader that fetches secrets from an Azure KeyVault

func NewEnvironmentSecretsReader Uses

func NewEnvironmentSecretsReader() SecretsReader

NewEnvironmentSecretsReader creates a SecretsReader for secrets provided via environment variables

type SecretsWriteDeleter Uses

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

SecretsWriteDeleter allows writing and deleting secrets

type StateProvider Uses

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 Uses

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 Uses

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

NewHelmStateProvider creates a StateProvider that sources Helm (actual state)

type Version Uses

type Version struct {
    SemVer    string
    GitCommit string
    GitTag    string
}

Version contains versioning information obtained during build

func GetVersion Uses

func GetVersion() Version

GetVersion provides the landscaper version and build information

Package landscaper imports 37 packages (graph) and is imported by 1 packages. Updated 2019-08-07. Refresh now. Tools for package owners.