Skip to content

Commit d4c5c28

Browse files
committed
metric marker fixes
1 parent a4a4504 commit d4c5c28

File tree

9 files changed

+37
-5
lines changed

9 files changed

+37
-5
lines changed

api/v1beta1/cluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ type ClusterStatus struct {
421421
// Conditions defines current service state of the cluster.
422422
// +optional
423423
// +Metrics:stateset:name="status_condition",help="The condition of a cluster.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
424+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a cluster.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
424425
Conditions Conditions `json:"conditions,omitempty"`
425426

426427
// ObservedGeneration is the latest generation observed by the controller.

api/v1beta1/clusterclass_types.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ const ClusterClassKind = "ClusterClass"
3535
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ClusterClass"
3636

3737
// ClusterClass is a template which can be used to create managed topologies.
38+
// +Metrics:namePrefix="capi_clusterclass"
39+
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
40+
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
41+
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid
42+
// +Metrics:info:name="info",help="Information about a clusterclass.",labelsFromPath={name:.metadata.name}
3843
type ClusterClass struct {
39-
metav1.TypeMeta `json:",inline"`
44+
metav1.TypeMeta `json:",inline"`
45+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
46+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the clusterclass is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
47+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
4048
metav1.ObjectMeta `json:"metadata,omitempty"`
4149

4250
Spec ClusterClassSpec `json:"spec,omitempty"`
@@ -647,6 +655,8 @@ type ClusterClassStatus struct {
647655

648656
// Conditions defines current observed state of the ClusterClass.
649657
// +optional
658+
// +Metrics:stateset:name="status_condition",help="The condition of a clusterclass.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
659+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a clusterclass.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
650660
Conditions Conditions `json:"conditions,omitempty"`
651661

652662
// ObservedGeneration is the latest generation observed by the controller.

api/v1beta1/machine_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ type MachineStatus struct {
207207
// CertificatesExpiryDate is the expiry date of the machine certificates.
208208
// This value is only set for control plane machines.
209209
// +optional
210+
// +Metrics:gauge:name="status_certificatesexpirydate",help="Information about certificate expiration date of a control plane node.",nilIsZero=true
210211
CertificatesExpiryDate *metav1.Time `json:"certificatesExpiryDate,omitempty"`
211212

212213
// BootstrapReady is the state of the bootstrap provider.
@@ -224,6 +225,7 @@ type MachineStatus struct {
224225
// Conditions defines current service state of the Machine.
225226
// +optional
226227
// +Metrics:stateset:name="status_condition",help="The condition of a machine.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
228+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a machine.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
227229
Conditions Conditions `json:"conditions,omitempty"`
228230
}
229231

@@ -288,7 +290,7 @@ type Bootstrap struct {
288290
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
289291
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
290292
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
291-
// +Metrics:info:name="info",help="Information about a machine.",labelsFromPath={container_runtime_version:.status.nodeInfo.containerRuntimeVersion,failure_domain:.spec.failureDomain,kernel_version:.status.nodeInfo.kernelVersion,kube_proxy_version:.status.nodeInfo.kubeProxyVersion,kubelet_version:.status.nodeInfo.kubeletVersion,os_image:.status.nodeInfo.osImage,provider_id:.spec.providerID,version:.spec.version}
293+
// +Metrics:info:name="info",help="Information about a machine.",labelsFromPath={bootstrap_reference_kind:.spec.bootstrap.configRef.kind,bootstrap_reference_name:.spec.bootstrap.configRef.name,container_runtime_version:.status.nodeInfo.containerRuntimeVersion,control_plane_name:.metadata.labels.cluster\.x-k8s\.io/control-plane-name,failure_domain:.spec.failureDomain,infrastructure_reference_kind:.spec.infrastructureRef.kind,infrastructure_reference_name:.spec.infrastructureRef.name,kernel_version:.status.nodeInfo.kernelVersion,kube_proxy_version:.status.nodeInfo.kubeProxyVersion,kubelet_version:.status.nodeInfo.kubeletVersion,os_image:.status.nodeInfo.osImage,provider_id:.spec.providerID,version:.spec.version}
292294
type Machine struct {
293295
metav1.TypeMeta `json:",inline"`
294296
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."

api/v1beta1/machinedeployment_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ type MachineDeploymentStatus struct {
269269
// Conditions defines current service state of the MachineDeployment.
270270
// +optional
271271
// +Metrics:stateset:name="status_condition",help="The condition of a machinedeployment.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
272+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a machinedeployment.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
272273
Conditions Conditions `json:"conditions,omitempty"`
273274
}
274275

@@ -335,6 +336,7 @@ func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase {
335336
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
336337
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
337338
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
339+
// +Metrics:info:name="info",help="Information about a machinedeployment.",labelsFromPath={bootstrap_reference_kind:.spec.template.spec.bootstrap.configRef.kind,bootstrap_reference_name:.spec.template.spec.bootstrap.configRef.name,infrastructure_reference_kind:.spec.template.spec.infrastructureRef.kind,infrastructure_reference_name:.spec.template.spec.infrastructureRef.name,version:.spec.template.spec.version}
338340
type MachineDeployment struct {
339341
metav1.TypeMeta `json:",inline"`
340342
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."

api/v1beta1/machinehealthcheck_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ type MachineHealthCheckStatus struct {
136136
// Conditions defines current service state of the MachineHealthCheck.
137137
// +optional
138138
// +Metrics:stateset:name="status_condition",help="The condition of a machinehealthcheck.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
139+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a machinehealthcheck.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
139140
Conditions Conditions `json:"conditions,omitempty"`
140141
}
141142

@@ -157,6 +158,7 @@ type MachineHealthCheckStatus struct {
157158
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
158159
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
159160
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
161+
// +Metrics:info:name="info",help="Information about a machinehealthcheck.",labelsFromPath={maxUnhealthy:.spec.maxUnhealthy}
160162
type MachineHealthCheck struct {
161163
metav1.TypeMeta `json:",inline"`
162164
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."

api/v1beta1/machineset_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ type MachineSetStatus struct {
134134

135135
// The number of replicas that have labels matching the labels of the machine template of the MachineSet.
136136
// +optional
137-
// +Metrics:gauge:name="status_fully_labeled_replicas",help="The number of fully labeled replicas per machineset.",nilIsZero=true
137+
// +Metrics:gauge:name="status_replicas_fully_labeled",help="The number of fully labeled replicas per machineset.",nilIsZero=true
138138
FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"`
139139

140140
// The number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready".
@@ -144,7 +144,7 @@ type MachineSetStatus struct {
144144

145145
// The number of available replicas (ready for at least minReadySeconds) for this MachineSet.
146146
// +optional
147-
// +Metrics:gauge:name="status_available_replicas",help="The number of available replicas per machineset.",nilIsZero=true
147+
// +Metrics:gauge:name="status_replicas_available",help="The number of available replicas per machineset.",nilIsZero=true
148148
AvailableReplicas int32 `json:"availableReplicas"`
149149

150150
// ObservedGeneration reflects the generation of the most recently observed MachineSet.
@@ -176,6 +176,7 @@ type MachineSetStatus struct {
176176
// Conditions defines current service state of the MachineSet.
177177
// +optional
178178
// +Metrics:stateset:name="status_condition",help="The condition of a machineset.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
179+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a machineset.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
179180
Conditions Conditions `json:"conditions,omitempty"`
180181
}
181182

@@ -223,6 +224,7 @@ func (m *MachineSet) Validate() field.ErrorList {
223224
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
224225
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
225226
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
227+
// +Metrics:info:name="info",help="Information about a machineset.",labelsFromPath={bootstrap_reference_kind:.spec.template.spec.bootstrap.configRef.kind,bootstrap_reference_name:.spec.template.spec.bootstrap.configRef.name,infrastructure_reference_kind:.spec.template.spec.infrastructureRef.kind,infrastructure_reference_name:.spec.template.spec.infrastructureRef.name,version:.spec.template.spec.version}
226228
type MachineSet struct {
227229
metav1.TypeMeta `json:",inline"`
228230
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."

bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ type KubeadmConfigStatus struct {
154154

155155
// Conditions defines current service state of the KubeadmConfig.
156156
// +optional
157+
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmconfig.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
158+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a kubeadmconfig.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
157159
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
158160
}
159161

@@ -165,8 +167,17 @@ type KubeadmConfigStatus struct {
165167
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmConfig"
166168

167169
// KubeadmConfig is the Schema for the kubeadmconfigs API.
170+
// +Metrics:namePrefix="capi_kubeadmconfig"
171+
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
172+
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
173+
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid
174+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
175+
// +Metrics:info:name="info",help="Information about a kubeadmconfig.",labelsFromPath={name:.metadata.name}
168176
type KubeadmConfig struct {
169-
metav1.TypeMeta `json:",inline"`
177+
metav1.TypeMeta `json:",inline"`
178+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
179+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the kubeadmconfig is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
180+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
170181
metav1.ObjectMeta `json:"metadata,omitempty"`
171182

172183
Spec KubeadmConfigSpec `json:"spec,omitempty"`

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ type KubeadmControlPlaneStatus struct {
299299
// Conditions defines current service state of the KubeadmControlPlane.
300300
// +optional
301301
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmcontrolplane.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
302+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a kubeadmcontrolplane.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
302303
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
303304

304305
// LastRemediation stores info about last remediation performed.

exp/api/v1beta1/machinepool_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type MachinePoolStatus struct {
129129
// Conditions define the current service state of the MachinePool.
130130
// +optional
131131
// +Metrics:stateset:name="status_condition",help="The condition of a machinepool.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
132+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition last transition time of a machinepool.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
132133
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
133134
}
134135

0 commit comments

Comments
 (0)