Documentation
¶
Index ¶
Constants ¶
const ( ComponentNet = "net" ComponentMachina = "machina" ComponentMetalman = "metalman" ComponentStorage = "storage" )
Component name identifiers. These mirror each component's Name() and are used by the legacy reaper (migrate.go) to gate per-component migration.
const CRDBootstrapTimeout = 4 * time.Minute
CRDBootstrapTimeout bounds the complete CRD bootstrap, including manifest applies and waiting for every CRD to be served by the apiserver. The operator health server only binds after bootstrap, so the startupProbe budget in deploy/unbounded-operator/04-deployment.yaml.tmpl must exceed this timeout.
const FieldOwner = component.FieldOwner
FieldOwner is the server-side apply field manager the operator uses. It is re-exported from the component package for callers within this package.
Variables ¶
var DefaultNamespace = component.DefaultNamespace
DefaultNamespace is the namespace the operator installs components into.
var LegacyNamespaces = []string{legacyKubeNamespace, legacyNetNamespace}
LegacyNamespaces are the pre-consolidation namespaces components used before everything moved to the unified namespace.
var RequiredCRDNames = [...]string{
"machines.unbounded-cloud.io",
"machineoperations.unbounded-cloud.io",
"sites.unbounded-cloud.io",
"machineconfigurations.unbounded-cloud.io",
"machineoperationcredentials.unbounded-cloud.io",
"machineconfigurationversions.unbounded-cloud.io",
"sitenodeslices.net.unbounded-cloud.io",
"gatewaypools.net.unbounded-cloud.io",
"gatewaypoolnodes.net.unbounded-cloud.io",
"sitegatewaypoolassignments.net.unbounded-cloud.io",
"sitepeerings.net.unbounded-cloud.io",
"gatewaypoolpeerings.net.unbounded-cloud.io",
}
RequiredCRDNames is the complete set of CRDs owned and bootstrapped by the unbounded-operator.
Functions ¶
func BootstrapCRDs ¶
BootstrapCRDs server-side applies every CustomResourceDefinition embedded in the machina and net manifests and waits for each to become Established. It is idempotent (safe to run on every operator start) and must run before the manager starts, because the typed Site informer cannot sync until the Site CRD is served.
func DefaultRegistry ¶
DefaultRegistry returns the built-in component registry: the net and machina cluster singletons and the metalman and storage per-Site components. The slice order is the stable Site status condition order (cluster first, then site).
Types ¶
type CRDMaintainer ¶
type CRDMaintainer struct {
Client client.Client
Interval time.Duration
Bootstrap func(context.Context, client.Client) error
}
CRDMaintainer periodically reapplies the operator-owned CRDs using an uncached client. Maintenance failures are logged and retried on the next interval; they never stop the manager. CRDs that are already established stay served by the apiserver regardless of the operator's liveness, so stopping on maintenance failures would needlessly take down the Site reconciler and the migration reaper for what is typically a transient apiserver blip.
func (*CRDMaintainer) NeedLeaderElection ¶
func (*CRDMaintainer) NeedLeaderElection() bool
NeedLeaderElection ensures only the elected operator replica maintains CRDs.
type LegacyReaper ¶
type LegacyReaper struct {
client.Client
// APIReader bypasses the manager cache for migration inventory, copy sources,
// target existence checks, and safety gates. It falls back to Client for
// direct construction in unit tests.
APIReader client.Reader
// TargetNamespace is the unified namespace components are consolidated into.
TargetNamespace string
// LegacyNamespaces is the set of pre-consolidation namespaces to drain.
LegacyNamespaces []string
// SkipSecretNames are regenerable secrets that must not be copied (e.g. the
// net controller serving cert, which is reissued on startup).
SkipSecretNames map[string]struct{}
// CopyConfigMaps are operator-owned ConfigMaps to carry across by name.
CopyConfigMaps []string
// APIServerEndpoint overrides the endpoint in migrated Machina config while
// preserving every other legacy setting.
APIServerEndpoint string
// Interval is the requeue period while waiting for target workloads to
// become healthy.
Interval time.Duration
// Recorder, when set, receives Events for notable migration actions (for
// example a legacy namespace that still holds non-operator workloads at
// delete time). Optional; nil disables Event emission.
Recorder events.EventRecorder
}
LegacyReaper migrates operator-owned state out of the legacy split namespaces into the unified namespace, translates the pre-redesign net-group Sites into the machina-group Sites the operator reconciles, and then deletes the operator-owned resources (and the now-empty legacy namespaces) left behind.
func (*LegacyReaper) NeedLeaderElection ¶
func (*LegacyReaper) NeedLeaderElection() bool
NeedLeaderElection ensures the reaper only runs on the elected leader.
func (*LegacyReaper) RunToCompletion ¶
func (r *LegacyReaper) RunToCompletion(ctx context.Context) error
RunToCompletion performs idempotent translate-migrate-reap passes until every legacy namespace is drained and deleted, the context is cancelled, or an unexpected error occurs. It returns nil only once fully reaped.
func (*LegacyReaper) SetupWithManager ¶
func (r *LegacyReaper) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the reaper as a leader-elected manager runnable.
type SiteReconciler ¶
type SiteReconciler struct {
client.Client
Scheme *runtime.Scheme
Config Config
// Namespace is the namespace components are reconciled into. When empty it
// falls back to component.DefaultNamespace so the operator follows the
// namespace it is installed in.
Namespace string
// Registry is the set of components to reconcile. When nil it defaults to
// DefaultRegistry.
Registry *component.Registry
}
SiteReconciler reconciles the registered components for every Site. It drives a component.Registry: cluster components (net, machina) run on every pass, and per-Site components (metalman, storage) run when a Site is present. Adding a component is a matter of implementing component.ClusterComponent or component.SiteComponent and adding it to the registry; this loop, the status conditions, ordering, and the Site-less pass are all registry-driven.
func (*SiteReconciler) SetupWithManager ¶
func (r *SiteReconciler) SetupWithManager(mgr ctrl.Manager) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package component defines the extension contract for the unbounded operator.
|
Package component defines the extension contract for the unbounded operator. |
|
components
|
|
|
machina
Package machina implements the machina controller cluster component.
|
Package machina implements the machina controller cluster component. |
|
metalman
Package metalman implements the per-Site metalman PXE controller component.
|
Package metalman implements the per-Site metalman PXE controller component. |
|
net
Package net implements the unbounded-net cluster component.
|
Package net implements the unbounded-net cluster component. |
|
storage
Package storage implements the per-Site unbounded-storage supervisor component.
|
Package storage implements the per-Site unbounded-storage supervisor component. |