Skip to content

Commit c653f3d

Browse files
committed
metrics-gen initial
1 parent 5289526 commit c653f3d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/v1beta1/cluster_types.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const (
4545
type ClusterSpec struct {
4646
// Paused can be used to prevent controllers from processing the Cluster and all its associated objects.
4747
// +optional
48+
// +Metrics:gauge:name="spec_paused",help="Whether the cluster is paused and any of its resources will not be processed by the controllers.",nilIsZero=true
4849
Paused bool `json:"paused,omitempty"`
4950

5051
// Cluster network configuration.
@@ -418,6 +419,7 @@ type ClusterStatus struct {
418419

419420
// Conditions defines current service state of the cluster.
420421
// +optional
422+
// +Metrics:stateset:name="status_condition",help="The condition of a cluster.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
421423
Conditions Conditions `json:"conditions,omitempty"`
422424

423425
// ObservedGeneration is the latest generation observed by the controller.
@@ -486,8 +488,14 @@ func (v APIEndpoint) String() string {
486488
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.topology.version",description="Kubernetes version associated with this Cluster"
487489

488490
// Cluster is the Schema for the clusters API.
491+
// +Metrics:namePrefix="capi_cluster"
492+
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
493+
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
494+
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
489495
type Cluster struct {
490-
metav1.TypeMeta `json:",inline"`
496+
metav1.TypeMeta `json:",inline"`
497+
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
498+
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the cluster is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
491499
metav1.ObjectMeta `json:"metadata,omitempty"`
492500

493501
Spec ClusterSpec `json:"spec,omitempty"`

0 commit comments

Comments
 (0)