Skip to content

Commit eed63e6

Browse files
yuyufeiyufeiyu
authored andcommitted
add printcolumn for Recommendation & Analytics
1 parent 09d430d commit eed63e6

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

analysis/v1alpha1/types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ const (
3131
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3232
// +kubebuilder:object:root=true
3333
// +kubebuilder:resource:shortName=recommend
34+
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`
35+
// +kubebuilder:printcolumn:name="TargetKind",type=string,JSONPath=`.spec.targetRef.kind`
36+
// +kubebuilder:printcolumn:name="TargetNamespace",type=string,JSONPath=`.spec.targetRef.namespace`
37+
// +kubebuilder:printcolumn:name="TargetName",type=string,JSONPath=`.spec.targetRef.name`
38+
// +kubebuilder:printcolumn:name="Strategy",type=string,JSONPath=`.spec.completionStrategy.completionStrategyType`
39+
// +kubebuilder:printcolumn:name="PeriodSeconds",type=string,JSONPath=`.spec.completionStrategy.periodSeconds`
40+
// +kubebuilder:printcolumn:name="AdoptionType",type=string,JSONPath=`.spec.adoptionType`
3441

3542
// Recommendation represents the configuration of a single recommendation.
3643
type Recommendation struct {
@@ -96,6 +103,9 @@ type RecommendationList struct {
96103
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
97104
// +kubebuilder:object:root=true
98105
// +kubebuilder:resource:shortName=analytics
106+
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`
107+
// +kubebuilder:printcolumn:name="Strategy",type=string,JSONPath=`.spec.completionStrategy.completionStrategyType`
108+
// +kubebuilder:printcolumn:name="PeriodSeconds",type=string,JSONPath=`.spec.completionStrategy.periodSeconds`
99109

100110
// Analytics represents the configuration of an analytics object.
101111
type Analytics struct {

artifacts/deploy/analysis.crane.io_analytics.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ spec:
1818
singular: analytics
1919
scope: Namespaced
2020
versions:
21-
- name: v1alpha1
21+
- additionalPrinterColumns:
22+
- jsonPath: .spec.type
23+
name: Type
24+
type: string
25+
- jsonPath: .spec.completionStrategy.completionStrategyType
26+
name: Strategy
27+
type: string
28+
- jsonPath: .spec.completionStrategy.periodSeconds
29+
name: PeriodSeconds
30+
type: string
31+
name: v1alpha1
2232
schema:
2333
openAPIV3Schema:
2434
description: Analytics represents the configuration of an analytics object.
@@ -328,6 +338,7 @@ spec:
328338
type: object
329339
served: true
330340
storage: true
341+
subresources: {}
331342
status:
332343
acceptedNames:
333344
kind: ""

artifacts/deploy/analysis.crane.io_recommendations.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,29 @@ spec:
1818
singular: recommendation
1919
scope: Namespaced
2020
versions:
21-
- name: v1alpha1
21+
- additionalPrinterColumns:
22+
- jsonPath: .spec.type
23+
name: Type
24+
type: string
25+
- jsonPath: .spec.targetRef.kind
26+
name: TargetKind
27+
type: string
28+
- jsonPath: .spec.targetRef.namespace
29+
name: TargetNamespace
30+
type: string
31+
- jsonPath: .spec.targetRef.name
32+
name: TargetName
33+
type: string
34+
- jsonPath: .spec.completionStrategy.completionStrategyType
35+
name: Strategy
36+
type: string
37+
- jsonPath: .spec.completionStrategy.periodSeconds
38+
name: PeriodSeconds
39+
type: string
40+
- jsonPath: .spec.adoptionType
41+
name: AdoptionType
42+
type: string
43+
name: v1alpha1
2244
schema:
2345
openAPIV3Schema:
2446
description: Recommendation represents the configuration of a single recommendation.
@@ -216,6 +238,7 @@ spec:
216238
type: object
217239
served: true
218240
storage: true
241+
subresources: {}
219242
status:
220243
acceptedNames:
221244
kind: ""

0 commit comments

Comments
 (0)