cluster-api: Index | Files

package config

import ""


Package Files

client.go imagemeta_client.go provider.go providers_client.go reader_viper.go variables_client.go


const (
    // Core providers
    ClusterAPIProviderName = "cluster-api"

    // Infra providers
    AWSProviderName       = "aws"
    AzureProviderName     = "azure"
    DockerProviderName    = "docker"
    DOProviderName        = "digitalocean"
    GCPProviderName       = "gcp"
    Metal3ProviderName    = "metal3"
    OpenStackProviderName = "openstack"
    PacketProviderName    = "packet"
    SideroProviderName    = "sidero"
    VSphereProviderName   = "vsphere"

    // Bootstrap providers
    KubeadmBootstrapProviderName = "kubeadm"
    TalosBootstrapProviderName   = "talos"
    AWSEKSBootstrapProviderName  = "aws-eks"

    // ControlPlane providers
    KubeadmControlPlaneProviderName = "kubeadm"
    TalosControlPlaneProviderName   = "talos"
    AWSEKSControlPlaneProviderName  = "aws-eks"

    // Other
    ProvidersConfigKey = "providers"
const (
    // ConfigFolder defines the name of the config folder under $home
    ConfigFolder = ".cluster-api"
    // ConfigName defines the name of the config file under ConfigFolder
    ConfigName = "clusterctl"
    // DownloadConfigFile is the config file when fetching the config from a remote location
    DownloadConfigFile = "clusterctl-download.yaml"
const (
    // GitHubTokenVariable defines a variable hosting the GitHub access token
    GitHubTokenVariable = "github-token"

func InjectConfigPaths Uses

func InjectConfigPaths(configPaths []string) viperReaderOption

type Client Uses

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

    // ImageMeta provide access to to image meta configurations.
    ImageMeta() ImageMetaClient

Client is used to interact with the clusterctl configurations. Clusterctl v2 handles the following configurations: 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 3. The configuration about image overrides

func New Uses

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

New returns a Client for interacting with the clusterctl configuration.

type ImageMetaClient Uses

type ImageMetaClient interface {
    // AlterImage alters an image name according to the current image override configurations.
    AlterImage(component, image string) (string, error)

ImageMetaClient has methods to work with image meta configurations.

type Option Uses

type Option func(*configClient)

Option is a configuration option supplied to New

func InjectReader Uses

func InjectReader(reader Reader) Option

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

type Provider Uses

type Provider interface {
    // Name returns the name of the provider.
    Name() string

    // Type returns the type of the provider.
    Type() clusterctlv1.ProviderType

    // URL returns the name of the provider repository.
    URL() string

    // SameAs returns true if two providers have the same name and type.
    // Please note that this uniquely identifies a provider configuration, but not the provider instances in the cluster
    // because it is possible to create many instances of the same provider.
    SameAs(other Provider) bool

    // ManifestLabel returns the label value for a provider.
    // Please note that this label uniquely identifies the provider, e.g. bootstrap-kubeadm, but not the instances of
    // the provider, e.g. namespace-1/bootstrap-kubeadm and namespace-2/bootstrap-kubeadm
    ManifestLabel() string

    // Less func can be used to ensure a consist order of provider lists.
    Less(other Provider) bool

Provider defines a provider configuration.

func NewProvider Uses

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

type ProvidersClient Uses

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/type.
    // In case the name/type does not correspond to any existing provider, an error is returned.
    Get(name string, providerType clusterctlv1.ProviderType) (Provider, error)

ProvidersClient has methods to work with provider configurations.

type Reader Uses

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 Uses

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.

Package config imports 17 packages (graph) and is imported by 11 packages. Updated 2020-12-29. Refresh now. Tools for package owners.