Expand description
pgroles candidate — file, list, inspect and diff PostgresPolicyCandidate
objects.
These commands cover the review side of the candidate workflow documented in
docs/src/pages/docs/operator-candidates.md: propose content, see what the
operator planned for it, and read the SQL a reviewer would be approving.
Deciding a plan is deliberately not here. A decision is a write to the
plan’s status subresource, gated by admission so that decidedBy records an
authenticated identity. Wrapping that in a CLI verb would blur who
authenticated it, so approval and rejection stay kubectl-shaped — see
Deciding a plan.
The Kubernetes objects are read as DynamicObject rather than through the
operator’s typed CRD structs: the CLI does not depend on pgroles-operator,
and a second copy of those types in this crate would be a second definition
of the API. Everything below therefore navigates serde_json::Value, which
also makes the formatting and selection logic unit-testable against literals.
Structs§
- Candidate
Row - One row of
pgroles candidate list. - Condition
- A condition read off a candidate or plan status.
Enums§
- Plan
SqlSource - Where a plan’s reviewed SQL actually lives.
Constants§
- CONTENT_
KEYS - The keys
PostgresPolicyCandidate.spec.contentaccepts, in the CRD’s own spelling. Anything outside this set is either dropped as execution config (seePOLICY_EXECUTION_KEYS) or rejected — never silently pruned by the API server, which would change the content digest without saying so. - POLICY_
EXECUTION_ KEYS PostgresPolicy.speckeys that describe execution, not content. A candidate always takes these from its parent policy, so they are dropped when a whole policy manifest is filed as a candidate.
Functions§
- abbreviate_
digest - Shorten a
sha256:…digest for table display. Full digests are 71 characters and would swamp every other column. - build_
candidate_ object - Build the
PostgresPolicyCandidateobject to create. - candidate_
row - Project a candidate object into a table row.
- cmd_
create pgroles candidate create— validate a local manifest and file it.- cmd_
diff pgroles candidate diff— the SQL approving this candidate’s plan would run.- cmd_
list pgroles candidate list— candidates filed against one policy.- cmd_
status pgroles candidate status— one candidate and its plan in detail.- decode_
configmap_ sql - Read the SQL out of the ConfigMap a plan’s
sqlRefnames. - extract_
candidate_ content - Extract the
spec.contentmapping from a local manifest. - find_
condition - Read a condition of the given type from an object’s
status.conditions. - format_
candidate_ status - Render
pgroles candidate statusfor one candidate and its plan. - format_
candidate_ table - Render rows as a padded table.
kubectl-shaped so the output can be read besidekubectl get pgcandwithout retraining the eye. - format_
plan_ decision - The plan’s write-once decision, and who made it.
- format_
plan_ staleness - Whether the plan still describes the candidate’s effects.
- format_
promotion_ outcome - What promotion has to say about this candidate, if anything.
- generate_
name_ prefix - Kubernetes appends five random characters to
generateNameand rejects the result past 253 characters, so the prefix is capped to leave room. - select_
plan_ sql - Decide where to read a plan’s SQL from.
- string_
at - Read a dotted path of string-keyed fields, e.g.
status.planRef.name.