Documentation
¶
Overview ¶
Package controller registers the reusable MachineOperation provider controller with a controller-runtime manager.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCapacityToManager ¶ added in v0.24.0
func AddCapacityToManager(mgr ctrl.Manager, providers []*machineops.Provider, options CapacityOptions) error
AddCapacityToManager registers the MachineClass controller for the provider registrations that declare capacity. The controller runs only while mgr holds its leader-election lease, so the caller must enable leader election on mgr with a lease ID unique to the scope (provider and Site). Two deployments must not have overlapping scopes: for example, an unscoped deployment next to one scoped to a Site would both write the same classes.
With options.EnableAllocationController it also registers the MachineAllocation controller, which needs the roles in deploy/machine-ops/05-machineallocation-rbac.yaml.tmpl. Install the two ValidatingAdmissionPolicies in deploy/machine-ops/06-machine-allocationref-policy.yaml.tmpl and deploy/machine-ops/07-machineallocation-bootstrap-token-policy.yaml.tmpl with it. The same manager must also call AddToManager with the same providers, because that registers the path that runs HostAllocate and HostRelease.
func AddToManager ¶ added in v0.1.23
AddToManager validates provider registrations and adds one MachineOperation reconciler to mgr. When a selected registration declares capacity, the reconciler also runs that registration's HostAllocate and HostRelease operations for the MachineAllocation controller.
Types ¶
type CapacityOptions ¶ added in v0.24.0
type CapacityOptions struct {
// ProviderName, when set, selects only this registration, which must
// declare capacity.
ProviderName string
// SiteName, when set, selects only classes whose spec.siteRef.name equals
// it.
SiteName string
// CredentialSecretNamespace is the only namespace credential Secrets are
// read from. It is required.
CredentialSecretNamespace string
// ProviderConfigNamespace is the only namespace provider-config and
// bootstrap files ConfigMaps are read from. It is required.
ProviderConfigNamespace string
// ClassRefreshInterval is how often a class is resolved again when no
// offering expires sooner. 0 means 5m. Otherwise it must be at least the
// effective MinRequeueInterval.
ClassRefreshInterval time.Duration
// MinRequeueInterval is the shortest requeue after a class resolved. 0
// means 10s. Otherwise it must be at least 1s and at most the effective
// ClassRefreshInterval.
MinRequeueInterval time.Duration
// EnableAllocationController registers the MachineAllocation controller
// next to the MachineClass controller. false keeps the earlier behavior:
// only the MachineClass controller runs.
EnableAllocationController bool
// AllocationConsumerKinds are the cluster-scoped consumer kinds whose
// termination and loss the MachineAllocation controller observes. Empty
// means consumer loss is never observed.
AllocationConsumerKinds []schema.GroupVersionKind
}
CapacityOptions scopes and tunes the capacity controllers. Later capacity controllers add fields to this struct, and the zero value of each new field keeps the earlier behavior.
EnableAllocationController adds the MachineAllocation controller. It needs the reusable roles in deploy/machine-ops/05-machineallocation-rbac.yaml.tmpl and the two ValidatingAdmissionPolicies in deploy/machine-ops/06-machine-allocationref-policy.yaml.tmpl and deploy/machine-ops/07-machineallocation-bootstrap-token-policy.yaml.tmpl. The same manager must also call AddToManager with the same providers, because that registers the path that runs HostAllocate and HostRelease.
type ClusterInfo ¶
type ClusterInfo = internalmachineops.ClusterInfo
ClusterInfo contains bootstrap data used by host replacement operations.
type Options ¶ added in v0.1.23
type Options struct {
SiteName string
ProviderName string
MaxConcurrentReconciles int
ProviderPollInterval time.Duration
ProviderStallAfter time.Duration
ProviderStalledPollInterval time.Duration
APIServerEndpoint string
CredentialSecretNamespace string
ClusterInfo *ClusterInfo
// ExperimentalContainerIsolation enables the experimental container
// isolation mode for HostReplace. See
// internal/machineops.MachineOperationReconciler.
ExperimentalContainerIsolation bool
}
Options scopes and tunes a MachineOperation provider controller.