Documentation
¶
Overview ¶
Package metalman implements the per-Site metalman PXE controller component.
Index ¶
- Constants
- func DeploymentName(site string) string
- func IsSupportObject(obj *unstructured.Unstructured) bool
- func New() component.SiteComponent
- func NewBootstrap() component.ClusterComponent
- type BootstrapComponent
- func (BootstrapComponent) ConditionType() string
- func (BootstrapComponent) Name() string
- func (c BootstrapComponent) Plan(ctx context.Context, env *component.Env, sites []unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
- func (BootstrapComponent) SetupWatches(b *builder.Builder, env *component.Env)
- type Component
- func (c Component) CleanupPlan(_ context.Context, env *component.Env, site *unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
- func (Component) ConditionType() string
- func (Component) Enabled(site *unboundedv1alpha3.Site) bool
- func (Component) Name() string
- func (c Component) Plan(_ context.Context, env *component.Env, site *unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
- func (Component) SetupWatches(b *builder.Builder, env *component.Env)
Constants ¶
const BootstrapMachineBindingName = "metalman:bootstrap-machine"
BootstrapMachineBindingName is the ClusterRoleBinding that grants the metalman-bootstrap ServiceAccount write access to Machine status. It must not be applied until the admission policy restricting that access is in place.
const BootstrapRestrictionPolicyName = "metalman-bootstrap-machine-restriction"
BootstrapRestrictionPolicyName names both the ValidatingAdmissionPolicy that restricts metalman bootstrap tokens and its binding.
const BootstrapServiceAccountName = "metalman-bootstrap"
BootstrapServiceAccountName is the ServiceAccount whose tokens metalman hands to booting machines.
const StaleAutoApproveBindingName = "metalman:node-autoapprove-bootstrap"
StaleAutoApproveBindingName is the ClusterRoleBinding that earlier releases installed to let kube-controller-manager auto-approve kubelet client certificates for any node requested with a metalman-bootstrap token. Metalman now approves those requests only for the attested Machine, so the binding must be removed on upgrade.
const SupportObjectNameSubstring = "metalman"
SupportObjectNameSubstring identifies the metalman RBAC objects that ship in the machina manifest set. It is exported so the machina component can skip exactly the objects the metalman component owns and applies.
Variables ¶
This section is empty.
Functions ¶
func DeploymentName ¶
DeploymentName is the per-site metalman Deployment name.
func IsSupportObject ¶
func IsSupportObject(obj *unstructured.Unstructured) bool
IsSupportObject reports whether obj is the metalman RBAC or admission policy that ships in the machina manifests. The machina component skips these; the metalman component applies them.
func NewBootstrap ¶ added in v0.17.0
func NewBootstrap() component.ClusterComponent
NewBootstrap returns the cluster-scoped metalman bootstrap component.
Types ¶
type BootstrapComponent ¶ added in v0.17.0
type BootstrapComponent struct{}
BootstrapComponent reconciles the shared metalman bootstrap support set: the support RBAC, the admission restriction, the restricted bootstrap grant, and the stale RBAC deletes.
It is cluster scoped so the set is planned exactly once per pass. The reconciler plans a per-Site component once for each Site, and each plan would verify the live restriction separately, so one pass could plan the same shared grant as both an apply and a delete. The executor rejects such conflicts before writing anything, which would also drop the revocation and the stale auto-approval delete.
It also covers the zero-Site case. With no Sites the machina component filters the support objects out of its own manifests, so an upgrade after the last Site was deleted would otherwise leave the old unrestricted grant and the legacy auto-approval binding in place while previously minted bootstrap tokens are still valid.
func (BootstrapComponent) ConditionType ¶ added in v0.17.0
func (BootstrapComponent) ConditionType() string
ConditionType implements component.ClusterComponent.
func (BootstrapComponent) Name ¶ added in v0.17.0
func (BootstrapComponent) Name() string
Name implements component.ClusterComponent.
func (BootstrapComponent) Plan ¶ added in v0.17.0
func (c BootstrapComponent) Plan(ctx context.Context, env *component.Env, sites []unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
Plan plans the shared support set once for the pass.
While any Site exists the set is always planned, whether or not a Site enables metalman, because bootstrap tokens minted earlier outlive the Deployment that handed them out.
With zero Sites the set is planned only when metalman bootstrap resources are already live: the metalman-bootstrap ServiceAccount, the metalman:bootstrap-machine binding, or the stale metalman:node-autoapprove-bootstrap binding. Any of them means a previous release installed metalman bootstrap access that may still be exercised by unexpired tokens. A cluster that never ran metalman has none of them and is left untouched, so the operator does not install metalman RBAC or admission policy there. Once applied, the ServiceAccount and binding stay present, so the trigger is stable across passes and does not churn.
func (BootstrapComponent) SetupWatches ¶ added in v0.17.0
func (BootstrapComponent) SetupWatches(b *builder.Builder, env *component.Env)
SetupWatches implements component.WatchProvider. Only object metadata is cached, since every event just re-runs Plan, which reads live state.
type Component ¶
type Component struct{}
Component reconciles the per-Site metalman PXE controller.
func (Component) CleanupPlan ¶ added in v0.3.0
func (c Component) CleanupPlan(_ context.Context, env *component.Env, site *unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
CleanupPlan removes the per-site metalman Deployment. The shared metalman RBAC is kept because other Sites may use it, and bootstrap tokens minted earlier stay valid after the Deployment is gone, so BootstrapComponent keeps planning the restriction, the restricted grant, and the stale RBAC deletes.
func (Component) ConditionType ¶
ConditionType implements component.SiteComponent.
func (Component) Enabled ¶
func (Component) Enabled(site *unboundedv1alpha3.Site) bool
Enabled reports whether the Site enables metalman.
func (Component) Plan ¶ added in v0.3.0
func (c Component) Plan(_ context.Context, env *component.Env, site *unboundedv1alpha3.Site) (*component.Plan, component.Result, error)
Plan deploys the per-site metalman PXE controller.
The shared support RBAC, the admission restriction, and the bootstrap grant are planned once per pass by BootstrapComponent, not here. Planning them per Site verified the live restriction once per Site, so two Sites in one pass could reach different verdicts and plan the same shared object both ways. The Deployment still depends on the restriction, which the cluster component adds to the same merged plan.
func (Component) SetupWatches ¶
SetupWatches recreates the per-site Deployment if it is deleted or drifts, via its controller owner reference to the Site. The predicate drops status-only updates so pod-count churn does not re-apply the Deployment.