Skip to content

Commit

Permalink
Add Conditions printcolumns to all resources
Browse files Browse the repository at this point in the history
  • Loading branch information
matthchr committed Aug 10, 2021
1 parent 62d6c85 commit aa25c92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hack/generator/pkg/codegen/pipeline/add_status_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func AddStatusConditions(idFactory astmodel.IdentifierFactory) Stage {
}
resourceType = resourceType.WithInterface(conditionerImpl)

// Resources with the genruntime.Conditioner interface should also have kubebuilder:printcolumn set
// so that the conditions are displayed
resourceType = resourceType.WithAnnotation("// +kubebuilder:printcolumn:name=\"Ready\",type=\"string\",JSONPath=\".status.conditions[?(@.type=='Ready')].status\"")
resourceType = resourceType.WithAnnotation("// +kubebuilder:printcolumn:name=\"Reason\",type=\"string\",JSONPath=\".status.conditions[?(@.type=='Ready')].reason\"")
resourceType = resourceType.WithAnnotation("// +kubebuilder:printcolumn:name=\"Message\",type=\"string\",JSONPath=\".status.conditions[?(@.type=='Ready')].message\"")

result.Add(def.WithType(resourceType))
}
result = defs.OverlayWith(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
type Person struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down

0 comments on commit aa25c92

Please sign in to comment.