config

package
v0.3.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterAPIProviderName          = "cluster-api"
	KubeadmBootstrapProviderName    = "kubeadm-bootstrap"
	KubeadmControlPlaneProviderName = "kubeadm-control-plane"
	DockerProviderName              = "docker"
	AWSProviderName                 = "aws"
	VSphereProviderName             = "vsphere"
	ProvidersConfigKey              = "providers"
	OpenStackProviderName           = "openstack"
)
View Source
const ConfigFolder = ".cluster-api"

ConfigFolder defines the name of the config folder under $home

View Source
const (
	// GitHubTokenVariable defines a variable hosting the GitHub access token
	GitHubTokenVariable = "github-token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Providers provide access to provider configurations.
	Providers() ProvidersClient

	// Variables provide access to environment variables and/or variables defined in the clusterctl configuration file.
	Variables() VariablesClient
}

Client is used to interact with the clusterctl configurations. Clusterctl v2 handles two types of configs: 1. The configuration of the providers (name, type and URL of the provider repository) 2. Variables used when installing providers/creating clusters. Variables can be read from the environment or from the config file

func New

func New(path string, options ...Option) (Client, error)

New returns a Client for interacting with the clusterctl configuration.

type Option

type Option func(*configClient)

Option is a configuration option supplied to New

func InjectReader

func InjectReader(reader Reader) Option

InjectReader allows to override the default configuration reader used by clusterctl.

type Provider

type Provider interface {
	Name() string
	URL() string
	Type() clusterctlv1.ProviderType
}

Provider defines a provider configuration.

func NewProvider

func NewProvider(name string, url string, ttype clusterctlv1.ProviderType) Provider

type ProvidersClient

type ProvidersClient interface {
	// List returns all the provider configurations, including provider configurations hard-coded in clusterctl
	// and user-defined provider configurations read from the clusterctl configuration file.
	// In case of conflict, user-defined provider override the hard-coded configurations.
	List() ([]Provider, error)

	// Get returns the configuration for the provider with a given name.
	// In case the name does not correspond to any existing provider, an error is returned.
	Get(name string) (Provider, error)
}

ProvidersClient has methods to work with provider configurations.

type Reader

type Reader interface {
	// Init allows to initialize the configuration reader.
	Init(path string) error

	// Get returns a configuration value of type string.
	// In case the configuration value does not exists, it returns an error.
	Get(key string) (string, error)

	// Set allows to set an explicit override for a config value.
	// e.g. It is used to set an override from a flag value over environment/config file variables.
	Set(key, value string)

	// UnmarshalKey reads a configuration value and unmarshals it into the provided value object.
	UnmarshalKey(key string, value interface{}) error
}

Reader define the behaviours of a configuration reader.

type VariablesClient

type VariablesClient interface {
	// Get returns a variable value. If the variable is not defined an error is returned.
	// In case the same variable is defined both within the environment variables and clusterctl configuration file,
	// the environment variables value takes precedence.
	Get(key string) (string, error)

	// Set allows to set an explicit override for a config value.
	// e.g. It is used to set an override from a flag value over environment/config file variables.
	Set(key, values string)
}

VariablesClient has methods to work with environment variables and with variables defined in the clusterctl configuration file.

Jump to

Keyboard shortcuts

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