cluster-api: sigs.k8s.io/cluster-api/cmd/clusterctl/client Index | Files | Directories

package client

import "sigs.k8s.io/cluster-api/cmd/clusterctl/client"

Index

Package Files

alias.go client.go common.go config.go delete.go get_kubeconfig.go init.go move.go upgrade.go

Constants

const DefaultCustomTemplateConfigMapKey = "template"

DefaultCustomTemplateConfigMapKey where the workload cluster template is hosted.

const NoopProvider = "-"

type ApplyUpgradeOptions Uses

type ApplyUpgradeOptions struct {
    // Kubeconfig to use for accessing the management cluster. If empty, default discovery rules apply.
    Kubeconfig Kubeconfig

    // ManagementGroup that should be upgraded (e.g. capi-system/cluster-api).
    ManagementGroup string

    // Contract defines the API Version of Cluster API (contract e.g. v1alpha3) the management group should upgrade to.
    // When upgrading by contract, the latest versions available will be used for all the providers; if you want
    // a more granular control on upgrade, use CoreProvider, BootstrapProviders, ControlPlaneProviders, InfrastructureProviders.
    Contract string

    // CoreProvider instance and version (e.g. capi-system/cluster-api:v0.3.0) to upgrade to. This field can be used as alternative to Contract.
    CoreProvider string

    // BootstrapProviders instance and versions (e.g. capi-kubeadm-bootstrap-system/kubeadm:v0.3.0) to upgrade to. This field can be used as alternative to Contract.
    BootstrapProviders []string

    // ControlPlaneProviders instance and versions (e.g. capi-kubeadm-control-plane-system/kubeadm:v0.3.0) to upgrade to. This field can be used as alternative to Contract.
    ControlPlaneProviders []string

    // InfrastructureProviders instance and versions (e.g. capa-system/aws:v0.5.0) to upgrade to. This field can be used as alternative to Contract.
    InfrastructureProviders []string
}

ApplyUpgradeOptions carries the options supported by upgrade apply.

type CertManagerUpgradePlan Uses

type CertManagerUpgradePlan cluster.CertManagerUpgradePlan

CertManagerUpgradePlan defines the upgrade plan if cert-manager needs to be upgraded to a different version.

type Client Uses

type Client interface {
    // GetProvidersConfig returns the list of providers configured for this instance of clusterctl.
    GetProvidersConfig() ([]Provider, error)

    // GetProviderComponents returns the provider components for a given provider with options including targetNamespace, watchingNamespace.
    GetProviderComponents(provider string, providerType clusterctlv1.ProviderType, options ComponentsOptions) (Components, error)

    // Init initializes a management cluster by adding the requested list of providers.
    Init(options InitOptions) ([]Components, error)

    // InitImages returns the list of images required for executing the init command.
    InitImages(options InitOptions) ([]string, error)

    // GetClusterTemplate returns a workload cluster template.
    GetClusterTemplate(options GetClusterTemplateOptions) (Template, error)

    // GetKubeconfig returns the kubeconfig of the workload cluster.
    GetKubeconfig(options GetKubeconfigOptions) (string, error)

    // Delete deletes providers from a management cluster.
    Delete(options DeleteOptions) error

    // Move moves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
    Move(options MoveOptions) error

    // PlanUpgrade returns a set of suggested Upgrade plans for the cluster, and more specifically:
    // - Each management group gets separated upgrade plans.
    // - For each management group, an upgrade plan is generated for each API Version of Cluster API (contract) available, e.g.
    //   - Upgrade to the latest version in the the v1alpha2 series: ....
    //   - Upgrade to the latest version in the the v1alpha3 series: ....
    PlanUpgrade(options PlanUpgradeOptions) ([]UpgradePlan, error)

    // PlanCertManagerUpgrade returns a CertManagerUpgradePlan.
    PlanCertManagerUpgrade(options PlanUpgradeOptions) (CertManagerUpgradePlan, error)

    // ApplyUpgrade executes an upgrade plan.
    ApplyUpgrade(options ApplyUpgradeOptions) error

    // ProcessYAML provides a direct way to process a yaml and inspect its
    // variables.
    ProcessYAML(options ProcessYAMLOptions) (YamlPrinter, error)
}

Client is exposes the clusterctl high-level client library.

func New Uses

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

New returns a configClient.

type ClusterClientFactory Uses

type ClusterClientFactory func(ClusterClientFactoryInput) (cluster.Client, error)

type ClusterClientFactoryInput Uses

type ClusterClientFactoryInput struct {
    Kubeconfig Kubeconfig
    Processor  Processor
}

ClusterClientFactoryInput reporesents the inputs required by the ClusterClientFactory

type Components Uses

type Components repository.Components

Components wraps a YAML file that defines the provider's components (CRDs, controller, RBAC rules etc.).

type ComponentsOptions Uses

type ComponentsOptions repository.ComponentsOptions

ComponentsOptions wraps inputs to get provider's components

type ConfigMapSourceOptions Uses

type ConfigMapSourceOptions struct {
    // Namespace where the ConfigMap exists. If unspecified, the current namespace will be used.
    Namespace string

    // Name to read the workload cluster template from.
    Name string

    // DataKey where the workload cluster template is hosted. If unspecified, the
    // DefaultCustomTemplateConfigMapKey will be used.
    DataKey string
}

ConfigMapSourceOptions defines the options to be used when reading a workload cluster template from a ConfigMap.

type DeleteOptions Uses

type DeleteOptions struct {
    // Kubeconfig defines the kubeconfig to use for accessing the management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    Kubeconfig Kubeconfig

    // Namespace where the provider to be deleted lives. If unspecified, the namespace name will be inferred
    // from the current configuration.
    Namespace string

    // CoreProvider version (e.g. cluster-api:v0.3.0) to add to the management cluster. If unspecified, the
    // cluster-api core provider's latest release is used.
    CoreProvider string

    // BootstrapProviders and versions (e.g. kubeadm:v0.3.0) to add to the management cluster.
    // If unspecified, the kubeadm bootstrap provider's latest release is used.
    BootstrapProviders []string

    // InfrastructureProviders and versions (e.g. aws:v0.5.0) to add to the management cluster.
    InfrastructureProviders []string

    // ControlPlaneProviders and versions (e.g. kubeadm:v0.3.0) to add to the management cluster.
    // If unspecified, the kubeadm control plane provider latest release is used.
    ControlPlaneProviders []string

    // DeleteAll set for deletion of all the providers.
    DeleteAll bool

    // IncludeNamespace forces the deletion of the namespace where the providers are hosted
    // (and of all the contained objects).
    IncludeNamespace bool

    // IncludeCRDs forces the deletion of the provider's CRDs (and of all the related objects).
    // By Extension, this forces the deletion of all the resources shared among provider instances, like e.g. web-hooks.
    IncludeCRDs bool
}

DeleteOptions carries the options supported by Delete.

type GetClusterTemplateOptions Uses

type GetClusterTemplateOptions struct {
    // Kubeconfig defines the kubeconfig to use for accessing the management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    Kubeconfig Kubeconfig

    // ProviderRepositorySource to be used for reading the workload cluster template from a provider repository;
    // only one template source can be used at time; if not other source will be set, a ProviderRepositorySource
    // will be generated inferring values from the cluster.
    ProviderRepositorySource *ProviderRepositorySourceOptions

    // URLSource to be used for reading the workload cluster template; only one template source can be used at time.
    URLSource *URLSourceOptions

    // ConfigMapSource to be used for reading the workload cluster template; only one template source can be used at time.
    ConfigMapSource *ConfigMapSourceOptions

    // TargetNamespace where the objects describing the workload cluster should be deployed. If unspecified,
    // the current namespace will be used.
    TargetNamespace string

    // ClusterName to be used for the workload cluster.
    ClusterName string

    // KubernetesVersion to use for the workload cluster. If unspecified, the value from os env variables
    // or the .cluster-api/clusterctl.yaml config file will be used.
    KubernetesVersion string

    // ControlPlaneMachineCount defines the number of control plane machines to be added to the workload cluster.
    // It can be set through the cli flag, CONTROL_PLANE_MACHINE_COUNT environment variable or will default to 1
    ControlPlaneMachineCount *int64

    // WorkerMachineCount defines number of worker machines to be added to the workload cluster.
    // It can be set through the cli flag, WORKER_MACHINE_COUNT environment variable or will default to 0
    WorkerMachineCount *int64

    // ListVariablesOnly sets the GetClusterTemplate method to return the list of variables expected by the template
    // without executing any further processing.
    ListVariablesOnly bool

    // YamlProcessor defines the yaml processor to use for the cluster
    // template processing. If not defined, SimpleProcessor will be used.
    YamlProcessor Processor
}

GetClusterTemplateOptions carries the options supported by GetClusterTemplate.

type GetKubeconfigOptions Uses

type GetKubeconfigOptions struct {
    // Kubeconfig defines the kubeconfig to use for accessing the management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    Kubeconfig Kubeconfig

    // Namespace is the namespace in which secret is placed.
    Namespace string

    // WorkloadClusterName is the name of the workload cluster.
    WorkloadClusterName string
}

GetKubeconfigOptions carries all the options supported by GetKubeconfig

type InitOptions Uses

type InitOptions struct {
    // Kubeconfig defines the kubeconfig to use for accessing the management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    Kubeconfig Kubeconfig

    // CoreProvider version (e.g. cluster-api:v0.3.0) to add to the management cluster. If unspecified, the
    // cluster-api core provider's latest release is used.
    CoreProvider string

    // BootstrapProviders and versions (e.g. kubeadm:v0.3.0) to add to the management cluster.
    // If unspecified, the kubeadm bootstrap provider's latest release is used.
    BootstrapProviders []string

    // InfrastructureProviders and versions (e.g. aws:v0.5.0) to add to the management cluster.
    InfrastructureProviders []string

    // ControlPlaneProviders and versions (e.g. kubeadm:v0.3.0) to add to the management cluster.
    // If unspecified, the kubeadm control plane provider latest release is used.
    ControlPlaneProviders []string

    // TargetNamespace defines the namespace where the providers should be deployed. If unspecified, each provider
    // will be installed in a provider's default namespace.
    TargetNamespace string

    // WatchingNamespace defines the namespace the providers should watch to reconcile Cluster API objects.
    // If unspecified, the providers watches for Cluster API objects across all namespaces.
    WatchingNamespace string

    // LogUsageInstructions instructs the init command to print the usage instructions in case of first run.
    LogUsageInstructions bool
    // contains filtered or unexported fields
}

InitOptions carries the options supported by Init.

type Kubeconfig Uses

type Kubeconfig cluster.Kubeconfig

Kubeconfig is a type that specifies inputs related to the actual kubeconfig.

type MoveOptions Uses

type MoveOptions struct {
    // FromKubeconfig defines the kubeconfig to use for accessing the source management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    FromKubeconfig Kubeconfig

    // ToKubeconfig defines the kubeconfig to use for accessing the target management cluster. If empty,
    // default rules for kubeconfig discovery will be used.
    ToKubeconfig Kubeconfig

    // Namespace where the objects describing the workload cluster exists. If unspecified, the current
    // namespace will be used.
    Namespace string

    // DryRun means the move action is a dry run, no real action will be performed
    DryRun bool
}

MoveOptions carries the options supported by move.

type Option Uses

type Option func(*clusterctlClient)

Option is a configuration option supplied to New

func InjectClusterClientFactory Uses

func InjectClusterClientFactory(factory ClusterClientFactory) Option

InjectClusterClientFactory allows to override the default factory used for creating ClusterClient objects.

func InjectConfig Uses

func InjectConfig(config config.Client) Option

InjectConfig allows to override the default configuration client used by clusterctl.

func InjectRepositoryFactory Uses

func InjectRepositoryFactory(factory RepositoryClientFactory) Option

InjectRepositoryFactory allows to override the default factory used for creating RepositoryClient objects.

type PlanUpgradeOptions Uses

type PlanUpgradeOptions struct {
    // Kubeconfig defines the kubeconfig to use for accessing the management cluster. If empty, default discovery rules apply.
    Kubeconfig Kubeconfig
}

PlanUpgradeOptions carries the options supported by upgrade plan.

type ProcessYAMLOptions Uses

type ProcessYAMLOptions struct {
    ReaderSource *ReaderSourceOptions
    // URLSource to be used for reading the template
    URLSource *URLSourceOptions

    // ListVariablesOnly return the list of variables expected by the template
    // without executing any further processing.
    ListVariablesOnly bool
}

ProcessYAMLOptions are the options supported by ProcessYAML.

type Processor Uses

type Processor yaml.Processor

Processor defines the methods necessary for creating a specific yaml processor.

type Provider Uses

type Provider config.Provider

Provider defines a provider configuration.

type ProviderRepositorySourceOptions Uses

type ProviderRepositorySourceOptions struct {
    // InfrastructureProvider to read the workload cluster template from. If unspecified, the default
    // infrastructure provider will be used if no other sources are specified.
    InfrastructureProvider string

    // Flavor defines The workload cluster template variant to be used when reading from the infrastructure
    // provider repository. If unspecified, the default cluster template will be used.
    Flavor string
}

ProviderRepositorySourceOptions defines the options to be used when reading a workload cluster template from a provider repository.

type ReaderSourceOptions Uses

type ReaderSourceOptions struct {
    Reader io.Reader
}

ReaderSourceOptions define the options to be used when reading a template from an arbitrary reader

type RepositoryClientFactory Uses

type RepositoryClientFactory func(RepositoryClientFactoryInput) (repository.Client, error)

type RepositoryClientFactoryInput Uses

type RepositoryClientFactoryInput struct {
    Provider  Provider
    Processor Processor
}

RepositoryClientFactoryInput represents the inputs required by the RepositoryClientFactory

type Template Uses

type Template repository.Template

Template wraps a YAML file that defines the cluster objects (Cluster, Machines etc.).

type URLSourceOptions Uses

type URLSourceOptions struct {
    // URL to read the workload cluster template from.
    URL string
}

URLSourceOptions defines the options to be used when reading a workload cluster template from an URL.

type UpgradePlan Uses

type UpgradePlan cluster.UpgradePlan

UpgradePlan defines a list of possible upgrade targets for a management group.

type YamlPrinter Uses

type YamlPrinter interface {
    // Variables required by the template.
    Variables() []string

    // Yaml returns yaml defining all the cluster template objects as a byte array.
    Yaml() ([]byte, error)
}

YamlPrinter exposes methods that prints the processed template and variables.

Directories

PathSynopsis
cluster
config
repository
yamlprocessor

Package client imports 16 packages (graph) and is imported by 4 packages. Updated 2020-10-29. Refresh now. Tools for package owners.