Skip to content

Commit

Permalink
add kubectl printcolumn
Browse files Browse the repository at this point in the history
Signed-off-by: frezes <[email protected]>
  • Loading branch information
frezes committed Jan 9, 2024
1 parent e40242b commit 5ff9dee
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 32 deletions.
33 changes: 32 additions & 1 deletion config/crd/bases/monitoring.whizard.io_compactors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ spec:
singular: compactor
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- description: The storage for service
jsonPath: .spec.disableDownsampling
name: DisableDownsampling
type: boolean
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Compactor is the Schema for the Compactor API
Expand Down Expand Up @@ -1427,6 +1439,25 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
retention:
description: Retention configs how long to retain samples
properties:
retention1h:
description: Retention1h specifies how long to retain samples
of 1h resolution in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
retention5m:
description: Retention5m specifies how long to retain samples
of 5m resolution in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
retentionRaw:
description: RetentionRaw specifies how long to retain raw samples
in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
type: object
secrets:
description: Secrets is a list of Secrets in the same namespace as
the component object, which shall be mounted into the Prometheus
Expand Down
14 changes: 13 additions & 1 deletion config/crd/bases/monitoring.whizard.io_gateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ spec:
singular: gateway
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.Node
name: Replicas
type: integer
- description: The nodePort of Gateway service
jsonPath: .spec.nodePort
name: NodePort
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Gateway is the Schema for the monitoring gateway API
Expand Down
14 changes: 13 additions & 1 deletion config/crd/bases/monitoring.whizard.io_ingesters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ spec:
singular: ingester
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- description: How long to retain raw samples on local storage.
jsonPath: .spec.localTsdbRetention
name: LocalTsdbRetention
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Ingester is the Schema for the Ingester API
Expand Down
10 changes: 9 additions & 1 deletion config/crd/bases/monitoring.whizard.io_queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: query
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Query is the Schema for the monitoring query API
Expand Down
10 changes: 9 additions & 1 deletion config/crd/bases/monitoring.whizard.io_queryfrontends.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: queryfrontend
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: QueryFrontend is the Schema for the monitoring queryfrontend
Expand Down
14 changes: 13 additions & 1 deletion config/crd/bases/monitoring.whizard.io_routers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ spec:
singular: router
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- description: How many times to replicate incoming write requests
jsonPath: .spec.replicationFactor
name: ReplicationFactor
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Router is the Schema for the monitoring router API
Expand Down
10 changes: 9 additions & 1 deletion config/crd/bases/monitoring.whizard.io_rulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: ruler
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Ruler is the Schema for the Ruler API
Expand Down
33 changes: 30 additions & 3 deletions config/crd/bases/monitoring.whizard.io_services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: service
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The storage for service
jsonPath: .spec.storage.name
name: Storage
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Service is the Schema for the monitoring service API
Expand Down Expand Up @@ -1504,6 +1512,25 @@ spec:
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
retention:
description: Retention configs how long to retain samples
properties:
retention1h:
description: Retention1h specifies how long to retain samples
of 1h resolution in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
retention5m:
description: Retention5m specifies how long to retain samples
of 5m resolution in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
retentionRaw:
description: RetentionRaw specifies how long to retain raw
samples in bucket
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
type: object
secrets:
description: Secrets is a list of Secrets in the same namespace
as the component object, which shall be mounted into the Prometheus
Expand Down Expand Up @@ -4460,8 +4487,8 @@ spec:
default: 3h
description: "DefaultIngesterRetentionPeriod Whizard default ingester
retention period when it has no tenant. \n Default: \"3h\""
format: int64
type: integer
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
defaultTenantsPerIngester:
default: 3
description: "DefaultTenantsPerIngester Whizard default tenant
Expand Down
10 changes: 9 additions & 1 deletion config/crd/bases/monitoring.whizard.io_stores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ spec:
singular: store
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- description: The number of desired replicas
jsonPath: .spec.replicas
name: Replicas
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Store is the Schema for the Store API
Expand Down
11 changes: 6 additions & 5 deletions pkg/api/monitoring/v1alpha1/service_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ limitations under the License.
package v1alpha1

import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -73,7 +71,7 @@ type IngesterTemplateSpec struct {
//
// Default: "3h"
// +kubebuilder:default:="3h"
DefaultIngesterRetentionPeriod time.Duration `json:"defaultIngesterRetentionPeriod,omitempty"`
DefaultIngesterRetentionPeriod Duration `json:"defaultIngesterRetentionPeriod,omitempty"`
}

type CompactorTemplateSpec struct {
Expand Down Expand Up @@ -119,9 +117,12 @@ type ServiceStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Storage",type="string",JSONPath=".spec.storage.name",description="The storage for service"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Service is the Schema for the monitoring service API
type Service struct {
Expand Down
63 changes: 47 additions & 16 deletions pkg/api/monitoring/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ type GatewayStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="NodePort",type="integer",JSONPath=".spec.nodePort",description="The nodePort of Gateway service"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Gateway is the Schema for the monitoring gateway API
type Gateway struct {
Expand Down Expand Up @@ -252,9 +256,12 @@ type QueryStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Query is the Schema for the monitoring query API
type Query struct {
Expand Down Expand Up @@ -290,9 +297,13 @@ type RouterStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="ReplicationFactor",type="integer",JSONPath=".spec.replicationFactor",description="How many times to replicate incoming write requests"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Router is the Schema for the monitoring router API
type Router struct {
Expand Down Expand Up @@ -350,9 +361,12 @@ type QueryFrontendStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// QueryFrontend is the Schema for the monitoring queryfrontend API
type QueryFrontend struct {
Expand Down Expand Up @@ -479,9 +493,12 @@ type StoreStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Store is the Schema for the Store API
type Store struct {
Expand All @@ -507,6 +524,9 @@ type CompactorSpec struct {
// DisableDownsampling specifies whether to disable downsampling
DisableDownsampling *bool `json:"disableDownsampling,omitempty"`

// Retention configs how long to retain samples
Retention *Retention `json:"retention,omitempty"`

// DataVolume specifies how volume shall be used
DataVolume *KubernetesVolume `json:"dataVolume,omitempty"`

Expand All @@ -520,9 +540,13 @@ type CompactorStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="DisableDownsampling",type="boolean",JSONPath=".spec.disableDownsampling",description="The storage for service"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Compactor is the Schema for the Compactor API
type Compactor struct {
Expand Down Expand Up @@ -577,9 +601,13 @@ type IngesterTenantStatus struct {
Obsolete bool `json:"obsolete"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="LocalTsdbRetention",type="string",JSONPath=".spec.localTsdbRetention",description="How long to retain raw samples on local storage."
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Ingester is the Schema for the Ingester API
type Ingester struct {
Expand Down Expand Up @@ -649,9 +677,12 @@ type RulerStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +genclient
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired replicas"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status

// Ruler is the Schema for the Ruler API
type Ruler struct {
Expand Down

0 comments on commit 5ff9dee

Please sign in to comment.