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

package cluster

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

Index

Package Files

cert_manager.go client.go components.go installer.go inventory.go inventory_managementgroup.go mover.go objectgraph.go proxy.go template.go upgrader.go upgrader_info.go workload_cluster.go

Variables

var (
    Scheme = scheme.Scheme
)

type CertManagerClient Uses

type CertManagerClient interface {
    // EnsureInstalled makes sure cert-manager is running and its API is available.
    // This is required to install a new provider.
    EnsureInstalled() error

    // EnsureLatestVersion checks the cert-manager version currently installed, and if it is
    // older than the version currently embedded in clusterctl, upgrades it.
    EnsureLatestVersion() error

    // PlanUpgrade retruns a CertManagerUpgradePlan with information regarding
    // a cert-manager upgrade if necessary.
    PlanUpgrade() (CertManagerUpgradePlan, error)

    // Images return the list of images required for installing the cert-manager.
    Images() ([]string, error)
}

CertManagerClient has methods to work with cert-manager components in the cluster.

type CertManagerUpgradePlan Uses

type CertManagerUpgradePlan struct {
    From, To      string
    ShouldUpgrade bool
}

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

type Client Uses

type Client interface {
    // Kubeconfig returns the kubeconfig used to access to a management cluster.
    Kubeconfig() Kubeconfig

    // Proxy return the Proxy used for operating objects in the management cluster.
    Proxy() Proxy

    // CertManager returns a CertManagerClient that can be user for
    // operating the cert-manager components in the cluster.
    CertManager() CertManagerClient

    // ProviderComponents returns a ComponentsClient object that can be user for
    // operating provider components objects in the management cluster (e.g. the CRDs, controllers, RBAC).
    ProviderComponents() ComponentsClient

    // ProviderInventory returns a InventoryClient object that can be user for
    // operating provider inventory stored in the management cluster (e.g. the list of installed providers/versions).
    ProviderInventory() InventoryClient

    // ProviderInstaller returns a ProviderInstaller that enforces consistency rules for provider installation,
    // trying to prevent e.g. controllers fighting for objects, inconsistent versions, etc.
    ProviderInstaller() ProviderInstaller

    // ObjectMover returns an ObjectMover that implements support for moving Cluster API objects (e.g. clusters, AWS clusters, machines, etc.).
    // from one management cluster to another management cluster.
    ObjectMover() ObjectMover

    // ProviderUpgrader returns a ProviderUpgrader that supports upgrading Cluster API providers.
    ProviderUpgrader() ProviderUpgrader

    // Template has methods to work with templates stored in the cluster.
    Template() TemplateClient

    // WorkloadCluster has methods for fetching kubeconfig of workload cluster from management cluster.
    WorkloadCluster() WorkloadCluster
}

Client is used to interact with a management cluster. A management cluster contains following categories of objects: - provider components (e.g. the CRDs, controllers, RBAC) - provider inventory items (e.g. the list of installed providers/versions) - provider objects (e.g. clusters, AWS clusters, machines etc.)

func New Uses

func New(kubeconfig Kubeconfig, configClient config.Client, options ...Option) Client

New returns a cluster.Client.

type ComponentsClient Uses

type ComponentsClient interface {
    // Create creates the provider components in the management cluster.
    Create(objs []unstructured.Unstructured) error

    // Delete deletes the provider components from the management cluster.
    // The operation is designed to prevent accidental deletion of user created objects, so
    // it is required to explicitly opt-in for the deletion of the namespace where the provider components are hosted
    // and for the deletion of the provider's CRDs.
    Delete(options DeleteOptions) error
}

ComponentsClient has methods to work with provider components in the cluster.

type DeleteOptions Uses

type DeleteOptions struct {
    Provider         clusterctlv1.Provider
    IncludeNamespace bool
    IncludeCRDs      bool
}

type InventoryClient Uses

type InventoryClient interface {
    // EnsureCustomResourceDefinitions installs the CRD required for creating inventory items, if necessary.
    // Nb. In order to provide a simpler out-of-the box experience, the inventory CRD
    // is embedded in the clusterctl binary.
    EnsureCustomResourceDefinitions() error

    // Create an inventory item for a provider instance installed in the cluster.
    Create(clusterctlv1.Provider) error

    // List returns the inventory items for all the provider instances installed in the cluster.
    List() (*clusterctlv1.ProviderList, error)

    // GetDefaultProviderName returns the default provider for a given ProviderType.
    // In case there is only a single provider for a given type, e.g. only the AWS infrastructure Provider, it returns
    // this as the default provider; In case there are more provider of the same type, there is no default provider.
    GetDefaultProviderName(providerType clusterctlv1.ProviderType) (string, error)

    // GetDefaultProviderVersion returns the default version for a given provider.
    // In case there is only a single version installed for a given provider, e.g. only the v0.4.1 version for the AWS provider, it returns
    // this as the default version; In case there are more version installed for the same provider, there is no default provider version.
    GetDefaultProviderVersion(provider string, providerType clusterctlv1.ProviderType) (string, error)

    // GetDefaultProviderNamespace returns the default namespace for a given provider.
    // In case there is only a single instance for a given provider, e.g. only the AWS provider in the capa-system namespace, it returns
    // this as the default namespace; In case there are more instances for the same provider installed in different namespaces, there is no default provider namespace.
    GetDefaultProviderNamespace(provider string, providerType clusterctlv1.ProviderType) (string, error)

    // GetManagementGroups returns the list of management groups defined in the management cluster.
    GetManagementGroups() (ManagementGroupList, error)
}

InventoryClient exposes methods to interface with a cluster's provider inventory.

type Kubeconfig Uses

type Kubeconfig struct {
    // Path to the kubeconfig file
    Path string
    // Specify context within the kubeconfig file. If empty, cluster client
    // will use the current context.
    Context string
}

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

type ManagementGroup Uses

type ManagementGroup struct {
    CoreProvider clusterctlv1.Provider
    Providers    []clusterctlv1.Provider
}

ManagementGroup is a group of providers composed by a CoreProvider and a set of Bootstrap/ControlPlane/Infrastructure providers watching objects in the same namespace. For example, a management group can be used for upgrades, in order to ensure all the providers in a management group support the same API Version of Cluster API (contract).

func (*ManagementGroup) Equals Uses

func (mg *ManagementGroup) Equals(other *ManagementGroup) bool

Equals return true if two management groups have the same core provider.

func (*ManagementGroup) GetProviderByInstanceName Uses

func (mg *ManagementGroup) GetProviderByInstanceName(instanceName string) *clusterctlv1.Provider

GetProviderByInstanceName returns a specific provider instance.

type ManagementGroupList Uses

type ManagementGroupList []ManagementGroup

ManagementGroupList defines a list of management groups

func (*ManagementGroupList) FindManagementGroupByProviderInstanceName Uses

func (ml *ManagementGroupList) FindManagementGroupByProviderInstanceName(instanceName string) *ManagementGroup

FindManagementGroupByProviderInstanceName return the management group that hosts a given provider.

type ObjectMover Uses

type ObjectMover interface {
    // Move moves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
    Move(namespace string, toCluster Client, dryRun bool) error
}

ObjectMover defines methods for moving Cluster API objects to another management cluster.

type Option Uses

type Option func(*clusterClient)

Option is a configuration option supplied to New

func InjectPollImmediateWaiter Uses

func InjectPollImmediateWaiter(pollImmediateWaiter PollImmediateWaiter) Option

InjectPollImmediateWaiter allows to override the default PollImmediateWaiter used by clusterctl.

func InjectProxy Uses

func InjectProxy(proxy Proxy) Option

InjectProxy allows to override the default proxy used by clusterctl.

func InjectRepositoryFactory Uses

func InjectRepositoryFactory(factory RepositoryClientFactory) Option

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

func InjectYamlProcessor Uses

func InjectYamlProcessor(p yaml.Processor) Option

InjectYamlProcessor allows you to override the yaml processor that the cluster client uses. By default, the SimpleProcessor is used. This is true even if a nil processor is injected.

type PollImmediateWaiter Uses

type PollImmediateWaiter func(interval, timeout time.Duration, condition wait.ConditionFunc) error

PollImmediateWaiter tries a condition func until it returns true, an error, or the timeout is reached.

type ProviderInstaller Uses

type ProviderInstaller interface {
    // Add adds a provider to the install queue.
    // NB. By deferring the installation, the installer service can perform validation of the target state of the management cluster
    // before actually starting the installation of new providers.
    Add(repository.Components)

    // Install performs the installation of the providers ready in the install queue.
    Install() ([]repository.Components, error)

    // Validate performs steps to validate a management cluster by looking at the current state and the providers in the queue.
    // The following checks are performed in order to ensure a fully operational cluster:
    // - There must be only one instance of the same provider per namespace
    // - Instances of the same provider must not be fighting for objects (no watching overlap)
    // - Providers must combine in valid management groups
    //   - All the providers must belong to one/only one management groups
    //   - All the providers in a management group must support the same API Version of Cluster API (contract)
    Validate() error

    // Images returns the list of images required for installing the providers ready in the install queue.
    Images() []string
}

ProviderInstaller defines methods for enforcing consistency rules for provider installation.

type ProviderUpgrader Uses

type ProviderUpgrader interface {
    // Plan 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 will be 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: ....
    Plan() ([]UpgradePlan, error)

    // ApplyPlan executes an upgrade following an UpgradePlan generated by clusterctl.
    ApplyPlan(coreProvider clusterctlv1.Provider, clusterAPIVersion string) error

    // ApplyCustomPlan plan executes an upgrade using the UpgradeItems provided by the user.
    ApplyCustomPlan(coreProvider clusterctlv1.Provider, providersToUpgrade ...UpgradeItem) error
}

ProviderUpgrader defines methods for supporting provider upgrade.

type Proxy Uses

type Proxy interface {
    // GetConfig returns the rest.Config
    GetConfig() (*rest.Config, error)

    // CurrentNamespace returns the namespace from the current context in the kubeconfig file
    CurrentNamespace() (string, error)

    // ValidateKubernetesVersion returns an error if management cluster version less than minimumKubernetesVersion
    ValidateKubernetesVersion() error

    // NewClient returns a new controller runtime Client object for working on the management cluster
    NewClient() (client.Client, error)

    // ListResources returns all the Kubernetes objects with the given labels existing the listed namespaces.
    ListResources(labels map[string]string, namespaces ...string) ([]unstructured.Unstructured, error)
}

type ProxyOption Uses

type ProxyOption func(p *proxy)

func InjectKubeconfigPaths Uses

func InjectKubeconfigPaths(paths []string) ProxyOption

func InjectProxyTimeout Uses

func InjectProxyTimeout(t time.Duration) ProxyOption

type RepositoryClientFactory Uses

type RepositoryClientFactory func(provider config.Provider, configClient config.Client, options ...repository.Option) (repository.Client, error)

type TemplateClient Uses

type TemplateClient interface {
    // GetFromConfigMap returns a workload cluster template from the given ConfigMap.
    GetFromConfigMap(namespace, name, dataKey, targetNamespace string, listVariablesOnly bool) (repository.Template, error)

    // GetFromURL returns a workload cluster template from the given URL.
    GetFromURL(templateURL, targetNamespace string, listVariablesOnly bool) (repository.Template, error)
}

TemplateClient has methods to work with templates stored in the cluster/out of the provider repository.

type TemplateClientInput Uses

type TemplateClientInput struct {
    // contains filtered or unexported fields
}

type UpgradeItem Uses

type UpgradeItem struct {
    clusterctlv1.Provider
    NextVersion string
}

UpgradeItem defines a possible upgrade target for a provider in the management group.

func (*UpgradeItem) UpgradeRef Uses

func (u *UpgradeItem) UpgradeRef() string

UpgradeRef returns a string identifying the upgrade item; this string is derived by the provider.

type UpgradePlan Uses

type UpgradePlan struct {
    Contract     string
    CoreProvider clusterctlv1.Provider
    Providers    []UpgradeItem
}

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

func (*UpgradePlan) UpgradeRef Uses

func (u *UpgradePlan) UpgradeRef() string

UpgradeRef returns a string identifying the upgrade plan; this string is derived by the core provider which is unique for each management group.

type WorkloadCluster Uses

type WorkloadCluster interface {
    // GetKubeconfig returns the kubeconfig of the workload cluster.
    GetKubeconfig(workloadClusterName string, namespace string) (string, error)
}

WorkloadCluster has methods for fetching kubeconfig of workload cluster from management cluster.

Package cluster imports 44 packages (graph) and is imported by 3 packages. Updated 2020-10-16. Refresh now. Tools for package owners.