From 99a03a0d61aa85294d313df06f1a1f4f1bf995fa Mon Sep 17 00:00:00 2001 From: Brad Davidson <brad.davidson@rancher.com> Date: Mon, 30 Jun 2025 23:33:48 +0000 Subject: [PATCH] Improve docs and table output for conditions Signed-off-by: Brad Davidson <brad.davidson@rancher.com> --- doc/plan.md | 2 +- pkg/apis/upgrade.cattle.io/v1/types.go | 6 ++++++ .../yaml/generated/upgrade.cattle.io_plans.yaml | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/plan.md b/doc/plan.md index ce4750a5..f747c4cf 100644 --- a/doc/plan.md +++ b/doc/plan.md @@ -138,7 +138,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `conditions` _GenericCondition array_ | | | | +| `conditions` _GenericCondition array_ | `LatestResolved` indicates that the latest version as per the spec has been determined.<br />`Validated` indicates that the plan spec has been validated.<br />`Complete` indicates that the latest version of the plan has completed on all selected nodes. If any Jobs for the Plan fail to complete, this condition will remain false, and the reason and message will reflect the source of the error. | | | | `latestVersion` _string_ | The latest version, as resolved from .spec.version, or the channel server. | | | | `latestHash` _string_ | The hash of the most recently applied plan .spec. | | | | `applying` _string array_ | List of Node names that the Plan is currently being applied on. | | | diff --git a/pkg/apis/upgrade.cattle.io/v1/types.go b/pkg/apis/upgrade.cattle.io/v1/types.go index 5bdc1396..58f4f323 100644 --- a/pkg/apis/upgrade.cattle.io/v1/types.go +++ b/pkg/apis/upgrade.cattle.io/v1/types.go @@ -27,6 +27,9 @@ var ( // +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.spec.upgrade.image` // +kubebuilder:printcolumn:name="Channel",type=string,JSONPath=`.spec.channel` // +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` +// +kubebuilder:printcolumn:name="Complete",type=string,JSONPath=`.status.conditions[?(@.type=='Complete')].status` +// +kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.conditions[?(@.message!='')].message` +// +kubebuilder:printcolumn:name="Applying",type=string,JSONPath=`.status.applying`,priority=10 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Plan represents a set of Jobs to apply an upgrade (or other operation) to set of Nodes. @@ -83,6 +86,9 @@ type PlanSpec struct { // PlanStatus represents the resulting state from processing Plan events. type PlanStatus struct { + // `LatestResolved` indicates that the latest version as per the spec has been determined. + // `Validated` indicates that the plan spec has been validated. + // `Complete` indicates that the latest version of the plan has completed on all selected nodes. If any Jobs for the Plan fail to complete, this condition will remain false, and the reason and message will reflect the source of the error. // +optional // +patchMergeKey=type // +patchStrategy=merge diff --git a/pkg/crds/yaml/generated/upgrade.cattle.io_plans.yaml b/pkg/crds/yaml/generated/upgrade.cattle.io_plans.yaml index ec741ed3..e04535ff 100644 --- a/pkg/crds/yaml/generated/upgrade.cattle.io_plans.yaml +++ b/pkg/crds/yaml/generated/upgrade.cattle.io_plans.yaml @@ -24,6 +24,16 @@ spec: - jsonPath: .spec.version name: Version type: string + - jsonPath: .status.conditions[?(@.type=='Complete')].status + name: Complete + type: string + - jsonPath: .status.conditions[?(@.message!='')].message + name: Message + type: string + - jsonPath: .status.applying + name: Applying + priority: 10 + type: string name: v1 schema: openAPIV3Schema: @@ -1155,6 +1165,10 @@ spec: type: string type: array conditions: + description: |- + `LatestResolved` indicates that the latest version as per the spec has been determined. + `Validated` indicates that the plan spec has been validated. + `Complete` indicates that the latest version of the plan has completed on all selected nodes. If any Jobs for the Plan fail to complete, this condition will remain false, and the reason and message will reflect the source of the error. items: properties: lastTransitionTime: -- GitLab