Skip to content

Commit d126012

Browse files
committed
Add printer columns and descriptions to JobRequest resource
1 parent c78e98a commit d126012

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

api/v1/jobrequest_types.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ type JobRequestPodSpecFrom struct {
2424
// +kubebuilder:validation:Enum=apps/v1;
2525
Group string `json:"group"`
2626
// +kubebuilder:validation:Enum=Deployment;
27-
Kind string `json:"kind"`
27+
Kind string `json:"kind"`
28+
// Selector for the resource which contains the pod spec to use for the job.
2829
LabelSelector metav1.LabelSelector `json:"labelSelector"`
2930
}
3031

@@ -46,6 +47,7 @@ type JobRequestSpec struct {
4647
}
4748

4849
// JobRequestStatus defines the observed state of JobRequest.
50+
4951
type JobRequestStatus struct {
5052
// Name of the Kubernetes Job created for this job request.
5153
JobName string `json:"jobName,omitempty"`
@@ -60,9 +62,14 @@ type JobRequestStatus struct {
6062
// +kubebuilder:object:root=true
6163
// +kubebuilder:subresource:status
6264
// +kubebuilder:resource:shortName=jr
65+
// +kubebuilder:printcolumn:name="Command",type=string,JSONPath=`.spec.command`
66+
// +kubebuilder:printcolumn:name="Arguments",type=string,JSONPath=`.spec.args`
6367
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`
68+
// +kubebuilder:printcolumn:name="Job Name",type=string,JSONPath=`.status.jobName`
69+
// +kubebuilder:printcolumn:name="Requested By",type=string,JSONPath=`.status.requestedBy`
70+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
6471

65-
// JobRequest is the Schema for the jobrequests API
72+
// JobRequest represents a request to run a command in the cluster.
6673
type JobRequest struct {
6774
metav1.TypeMeta `json:",inline"`
6875

config/crd/bases/platform.publishing.service.gov.uk_jobrequests.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,28 @@ spec:
1717
scope: Namespaced
1818
versions:
1919
- additionalPrinterColumns:
20+
- jsonPath: .spec.command
21+
name: Command
22+
type: string
23+
- jsonPath: .spec.args
24+
name: Arguments
25+
type: string
2026
- jsonPath: .status.state
2127
name: State
2228
type: string
29+
- jsonPath: .status.jobName
30+
name: Job Name
31+
type: string
32+
- jsonPath: .status.requestedBy
33+
name: Requested By
34+
type: string
35+
- jsonPath: .metadata.creationTimestamp
36+
name: Age
37+
type: date
2338
name: v1
2439
schema:
2540
openAPIV3Schema:
26-
description: JobRequest is the Schema for the jobrequests API
41+
description: JobRequest represents a request to run a command in the cluster.
2742
properties:
2843
apiVersion:
2944
description: |-
@@ -72,10 +87,8 @@ spec:
7287
- Deployment
7388
type: string
7489
labelSelector:
75-
description: |-
76-
A label selector is a label query over a set of resources. The result of matchLabels and
77-
matchExpressions are ANDed. An empty label selector matches all objects. A null
78-
label selector matches no objects.
90+
description: Selector for the resource which contains the
91+
pod spec to use for the job.
7992
properties:
8093
matchExpressions:
8194
description: matchExpressions is a list of label selector

0 commit comments

Comments
 (0)