Skip to content

Commit

Permalink
add printcolumn for Recommendation & Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyufei authored and yufeiyu committed Jun 11, 2022
1 parent 09d430d commit eed63e6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
10 changes: 10 additions & 0 deletions analysis/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=recommend
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`
// +kubebuilder:printcolumn:name="TargetKind",type=string,JSONPath=`.spec.targetRef.kind`
// +kubebuilder:printcolumn:name="TargetNamespace",type=string,JSONPath=`.spec.targetRef.namespace`
// +kubebuilder:printcolumn:name="TargetName",type=string,JSONPath=`.spec.targetRef.name`
// +kubebuilder:printcolumn:name="Strategy",type=string,JSONPath=`.spec.completionStrategy.completionStrategyType`
// +kubebuilder:printcolumn:name="PeriodSeconds",type=string,JSONPath=`.spec.completionStrategy.periodSeconds`
// +kubebuilder:printcolumn:name="AdoptionType",type=string,JSONPath=`.spec.adoptionType`

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

// Analytics represents the configuration of an analytics object.
type Analytics struct {
Expand Down
13 changes: 12 additions & 1 deletion artifacts/deploy/analysis.crane.io_analytics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ spec:
singular: analytics
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .spec.type
name: Type
type: string
- jsonPath: .spec.completionStrategy.completionStrategyType
name: Strategy
type: string
- jsonPath: .spec.completionStrategy.periodSeconds
name: PeriodSeconds
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: Analytics represents the configuration of an analytics object.
Expand Down Expand Up @@ -328,6 +338,7 @@ spec:
type: object
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
Expand Down
25 changes: 24 additions & 1 deletion artifacts/deploy/analysis.crane.io_recommendations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,29 @@ spec:
singular: recommendation
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .spec.type
name: Type
type: string
- jsonPath: .spec.targetRef.kind
name: TargetKind
type: string
- jsonPath: .spec.targetRef.namespace
name: TargetNamespace
type: string
- jsonPath: .spec.targetRef.name
name: TargetName
type: string
- jsonPath: .spec.completionStrategy.completionStrategyType
name: Strategy
type: string
- jsonPath: .spec.completionStrategy.periodSeconds
name: PeriodSeconds
type: string
- jsonPath: .spec.adoptionType
name: AdoptionType
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: Recommendation represents the configuration of a single recommendation.
Expand Down Expand Up @@ -216,6 +238,7 @@ spec:
type: object
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
Expand Down

0 comments on commit eed63e6

Please sign in to comment.