Documentation ¶
Index ¶
- Variables
- type CertManagerClient
- type Client
- type ComponentsClient
- type DeleteOptions
- type InventoryClient
- type ManagementGroup
- type ManagementGroupList
- type ObjectMover
- type Option
- type PollImmediateWaiter
- type ProviderInstaller
- type ProviderUpgrader
- type Proxy
- type RepositoryClientFactory
- type TemplateClient
- type UpgradeItem
- type UpgradePlan
Constants ¶
This section is empty.
Variables ¶
var (
Scheme = scheme.Scheme
)
Functions ¶
This section is empty.
Types ¶
type CertManagerClient ¶
type CertManagerClient interface { // EnsureWebhook makes sure the cert-manager Webhook is Available in a cluster: // this is a requirement to install a new provider EnsureWebhook() 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 Client ¶
type Client interface { // Kubeconfig return the path to kubeconfig used to access to a management cluster. Kubeconfig() string // 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 }
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.)
type ComponentsClient ¶
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 ¶
type DeleteOptions struct { Provider clusterctlv1.Provider IncludeNamespace bool IncludeCRDs bool }
type InventoryClient ¶
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 ManagementGroup ¶
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 ¶
func (mg *ManagementGroup) Equals(other *ManagementGroup) bool
Equals return true if two management groups have the same core provider.
func (*ManagementGroup) GetProviderByInstanceName ¶
func (mg *ManagementGroup) GetProviderByInstanceName(instanceName string) *clusterctlv1.Provider
GetProviderByInstanceName returns a specific provider instance.
type ManagementGroupList ¶
type ManagementGroupList []ManagementGroup
ManagementGroupList defines a list of management groups
func (*ManagementGroupList) FindManagementGroupByProviderInstanceName ¶
func (ml *ManagementGroupList) FindManagementGroupByProviderInstanceName(instanceName string) *ManagementGroup
FindManagementGroupByProviderInstanceName return the management group that hosts a given provider.
type ObjectMover ¶
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) error }
ObjectMover defines methods for moving Cluster API objects to another management cluster.
type Option ¶
type Option func(*clusterClient)
Option is a configuration option supplied to New
func InjectPollImmediateWaiter ¶
func InjectPollImmediateWaiter(pollImmediateWaiter PollImmediateWaiter) Option
InjectPollImmediateWaiter allows to override the default PollImmediateWaiter used by clusterctl.
func InjectProxy ¶
InjectProxy allows to override the default proxy used by clusterctl.
func InjectRepositoryFactory ¶
func InjectRepositoryFactory(factory RepositoryClientFactory) Option
InjectRepositoryFactory allows to override the default factory used for creating RepositoryClient objects.
type PollImmediateWaiter ¶
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 ¶
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 ¶
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 }
ProviderUpgrader defines methods for supporting provider upgrade.
type Proxy ¶
type Proxy interface { // CurrentNamespace returns the namespace from the current context in the kubeconfig file CurrentNamespace() (string, 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 RepositoryClientFactory ¶
type RepositoryClientFactory func(provider config.Provider, configVariablesClient config.VariablesClient, options ...repository.Option) (repository.Client, error)
type TemplateClient ¶
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 UpgradeItem ¶
type UpgradeItem struct { clusterctlv1.Provider NextVersion string }
UpgradeItem defines a possible upgrade target for a provider in the management group.
func (*UpgradeItem) UpgradeRef ¶
func (u *UpgradeItem) UpgradeRef() string
UpgradeRef returns a string identifying the upgrade item; this string is derived by the provider.
type UpgradePlan ¶
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 ¶
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.