Documentation
¶
Overview ¶
Package crdcheck lets the agent and the operator refuse to start against CRDs that are older than they are. helm does not update the crds/ directory, so a release upgraded without `kubectl apply` leaves the API server pruning the new fields; for the enrollment epoch that means a token burnt for nothing. The check reads the published OpenAPI schema of the laboratory group (no extra permission: discovery is open to every authenticated client) and looks for the fields the binary needs.
Index ¶
- Constants
- Variables
- func GangCommitFieldsMissing(ctx context.Context, get GetCRD) ([]string, error)
- func UsableBudget(ctx context.Context, get GetCRD, m nodecap.Maximum, retry time.Duration) (_ nodecap.Maximum, why string, kept error)
- func Verify(ctx context.Context, fetch Fetch) error
- func Wait(ctx context.Context, fetch Fetch, timeout time.Duration, log func(error)) error
- type Fetch
- type GetCRD
Constants ¶
const BudgetRetry = 30 * time.Second
BudgetRetry is how long UsableBudget retries a read that fails for a passing reason.
Variables ¶
var GangCommitFields = []string{"withdrawals", "retryAfter", "onBudget", "schedulerMessage"}
GangCommitFields are the scheduling fields the gang commit writes.
var Required = []struct{ Field, On string }{
{"certificateEpoch", "Tenant.status"},
}
Required are the schema fields that came with this version (a JSON property name each, and the object it belongs to for the message).
Functions ¶
func GangCommitFieldsMissing ¶ added in v1.5.0
GangCommitFieldsMissing names the fields of the gang commit the served Device and LabGroup CRDs lack ("<crd>: <field>"); none: the CRDs are current. An error is the read's.
func UsableBudget ¶ added in v1.5.0
func UsableBudget(ctx context.Context, get GetCRD, m nodecap.Maximum, retry time.Duration) (_ nodecap.Maximum, why string, kept error)
UsableBudget is the capacity maximum to run with: m when it has no budget or the served CRDs know the fields of the gang commit; none (the maximum is the current capacity) when a CRD lacks them, is missing or may not be read, with why. A read that fails for another reason (the API server busy, a timeout) is retried with a growing pause for up to retry; if it still fails the budget is kept, since nothing says the CRDs are old, and kept is that last error for the caller to log.
Types ¶
type Fetch ¶
Fetch returns the OpenAPI v3 document of the laboratory group.
func FromDiscovery ¶
func FromDiscovery(d discovery.DiscoveryInterface) Fetch
FromDiscovery reads the document through the discovery client.