Documentation ¶
Overview ¶
Package config implements clusterctl config functionality.
Index ¶
- Constants
- type CertManager
- type CertManagerClient
- type Client
- type ImageMetaClient
- type MemoryReader
- func (f *MemoryReader) AddProvider(name string, ttype clusterctlv1.ProviderType, url string) (*MemoryReader, error)
- func (f *MemoryReader) Get(key string) (string, error)
- func (f *MemoryReader) Init(_ string) error
- func (f *MemoryReader) Set(key, value string)
- func (f *MemoryReader) UnmarshalKey(key string, rawval interface{}) error
- type Option
- type Provider
- type ProvidersClient
- type Reader
- type VariablesClient
Constants ¶
const ( // CertManagerConfigKey defines the name of the top level config key for cert-manager configuration. CertManagerConfigKey = "cert-manager" // CertManagerDefaultVersion defines the default cert-manager version to be used by clusterctl. CertManagerDefaultVersion = "v1.13.2" // CertManagerDefaultURL defines the default cert-manager repository url to be used by clusterctl. // NOTE: At runtime CertManagerDefaultVersion may be replaced with the // version defined by the user in the clusterctl configuration file. CertManagerDefaultURL = "https://github.com/cert-manager/cert-manager/releases/" + CertManagerDefaultVersion + "/cert-manager.yaml" // CertManagerDefaultTimeout defines the default cert-manager timeout to be used by clusterctl. CertManagerDefaultTimeout = 10 * time.Minute )
const ( AWSProviderName = "aws" AzureProviderName = "azure" BYOHProviderName = "byoh" CloudStackProviderName = "cloudstack" DockerProviderName = "docker" DOProviderName = "digitalocean" GCPProviderName = "gcp" HetznerProviderName = "hetzner" OutscaleProviderName = "outscale" IBMCloudProviderName = "ibmcloud" InMemoryProviderName = "in-memory" Metal3ProviderName = "metal3" NestedProviderName = "nested" NutanixProviderName = "nutanix" OCIProviderName = "oci" OpenStackProviderName = "openstack" PacketProviderName = "packet" SideroProviderName = "sidero" VCloudDirectorProviderName = "vcd" VSphereProviderName = "vsphere" MAASProviderName = "maas" KubevirtProviderName = "kubevirt" KubeKeyProviderName = "kubekey" VclusterProviderName = "vcluster" VirtinkProviderName = "virtink" CoxEdgeProviderName = "coxedge" )
Infra providers.
const ( KubeadmBootstrapProviderName = "kubeadm" TalosBootstrapProviderName = "talos" MicroK8sBootstrapProviderName = "microk8s" OracleCloudNativeBootstrapProviderName = "ocne" KubeKeyK3sBootstrapProviderName = "kubekey-k3s" )
Bootstrap providers.
const ( KubeadmControlPlaneProviderName = "kubeadm" TalosControlPlaneProviderName = "talos" MicroK8sControlPlaneProviderName = "microk8s" NestedControlPlaneProviderName = "nested" OracleCloudNativeControlPlaneProviderName = "ocne" KubeKeyK3sControlPlaneProviderName = "kubekey-k3s" )
ControlPlane providers.
const ( // ConfigFolder defines the old name of the config folder under $HOME. ConfigFolder = ".cluster-api" // ConfigFolderXDG defines the name of the config folder under $XDG_CONFIG_HOME. ConfigFolderXDG = "cluster-api" // ConfigName defines the name of the config file under ConfigFolderXDG. ConfigName = "clusterctl" // DownloadConfigFile is the config file when fetching the config from a remote location. DownloadConfigFile = "clusterctl-download.yaml" )
const (
// CertManagerImageComponent define the name of the cert-manager component in image overrides.
CertManagerImageComponent = "cert-manager"
)
const (
// ClusterAPIProviderName is the name for the core provider.
ClusterAPIProviderName = "cluster-api"
)
core providers.
const (
// GitHubTokenVariable defines a variable hosting the GitHub access token.
GitHubTokenVariable = "github-token"
)
const (
HelmAddonProviderName = "helm"
)
Add-on providers.
const (
// ProvidersConfigKey is a constant for finding provider configurations with the ProvidersClient.
ProvidersConfigKey = "providers"
)
Other.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertManager ¶ added in v0.4.0
type CertManager interface { // URL returns the name of the cert-manager repository. // If empty, "https://github.com/cert-manager/cert-manager/releases/{DefaultVersion}/cert-manager.yaml" will be used. URL() string // Version returns the cert-manager version to install. // If empty, a default version will be used. Version() string // Timeout returns the timeout for cert-manager to start. // If empty, 10m will be used. Timeout() string }
CertManager defines cert-manager configuration.
func NewCertManager ¶ added in v0.4.0
func NewCertManager(url, version, timeout string) CertManager
NewCertManager creates a new CertManager with the given configuration.
type CertManagerClient ¶ added in v0.4.0
type CertManagerClient interface { // Get returns the cert-manager configuration. Get() (CertManager, error) }
CertManagerClient has methods to work with cert-manager configurations.
type Client ¶
type Client interface { // CertManager provide access to the cert-manager configurations. CertManager() CertManagerClient // 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 image meta configurations. ImageMeta() ImageMetaClient }
Client is used to interact with the clusterctl configurations. Clusterctl v2 handles the following configurations: 1. The cert manager configuration (URL of the repository) 2. The configuration of the providers (name, type and URL of the provider repository) 3. Variables used when installing providers/creating clusters. Variables can be read from the environment or from the config file 4. The configuration about image overrides.
type ImageMetaClient ¶
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 MemoryReader ¶ added in v0.4.3
type MemoryReader struct {
// contains filtered or unexported fields
}
MemoryReader provides a reader implementation backed by a map. This is to be used by the operator to place config from a secret and the ProviderSpec.Fetchconfig.
func NewMemoryReader ¶ added in v0.4.3
func NewMemoryReader() *MemoryReader
NewMemoryReader return a new MemoryReader.
func (*MemoryReader) AddProvider ¶ added in v0.4.3
func (f *MemoryReader) AddProvider(name string, ttype clusterctlv1.ProviderType, url string) (*MemoryReader, error)
AddProvider adds the given provider to the "providers" map entry and returns any errors.
func (*MemoryReader) Get ¶ added in v0.4.3
func (f *MemoryReader) Get(key string) (string, error)
Get gets a value for the given key.
func (*MemoryReader) Init ¶ added in v0.4.3
func (f *MemoryReader) Init(_ string) error
Init initialize the reader.
func (*MemoryReader) Set ¶ added in v0.4.3
func (f *MemoryReader) Set(key, value string)
Set sets a value for the given key.
func (*MemoryReader) UnmarshalKey ¶ added in v0.4.3
func (f *MemoryReader) UnmarshalKey(key string, rawval interface{}) error
UnmarshalKey gets a value for the given key, then unmarshal it.
type Option ¶
type Option func(*configClient)
Option is a configuration option supplied to New.
func InjectReader ¶
InjectReader allows to override the default configuration reader used by clusterctl.
type Provider ¶
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 cluster.x-k8s.io/provider 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 ¶
func NewProvider(name string, url string, ttype clusterctlv1.ProviderType) Provider
NewProvider creates a new Provider with the given input.
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/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 ¶
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.