Skip to content

Commit 4d97b4c

Browse files
committed
hack/kube-state-metrics: improve static definition
1 parent d4c5c28 commit 4d97b4c

File tree

14 files changed

+33
-25
lines changed

14 files changed

+33
-25
lines changed

api/v1beta1/cluster_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ func (v APIEndpoint) String() string {
490490
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.topology.version",description="Kubernetes version associated with this Cluster"
491491

492492
// Cluster is the Schema for the clusters API.
493-
// +Metrics:namePrefix="capi_cluster"
493+
// +Metrics:gvk:namePrefix="capi_cluster"
494494
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
495495
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
496496
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid

api/v1beta1/clusterclass_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ 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"
38+
// +Metrics:gvk:namePrefix="capi_clusterclass"
3939
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
4040
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
4141
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid

api/v1beta1/machine_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ type Bootstrap struct {
285285
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version",description="Kubernetes version associated with this Machine"
286286

287287
// Machine is the Schema for the machines API.
288-
// +Metrics:namePrefix="capi_machine"
288+
// +Metrics:gvk:namePrefix="capi_machine"
289289
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
290290
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
291291
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"

api/v1beta1/machinedeployment_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase {
331331
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachineDeployment"
332332

333333
// MachineDeployment is the Schema for the machinedeployments API.
334-
// +Metrics:namePrefix="capi_machinedeployment"
334+
// +Metrics:gvk:namePrefix="capi_machinedeployment"
335335
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
336336
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
337337
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"

api/v1beta1/machinehealthcheck_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ type MachineHealthCheckStatus struct {
153153
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachineHealthCheck"
154154

155155
// MachineHealthCheck is the Schema for the machinehealthchecks API.
156-
// +Metrics:namePrefix="capi_machinehealthcheck"
156+
// +Metrics:gvk:namePrefix="capi_machinehealthcheck"
157157
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
158158
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
159159
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"

api/v1beta1/machineset_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (m *MachineSet) Validate() field.ErrorList {
219219
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachineSet"
220220

221221
// MachineSet is the Schema for the machinesets API.
222-
// +Metrics:namePrefix="capi_machineset"
222+
// +Metrics:gvk:namePrefix="capi_machineset"
223223
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
224224
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
225225
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"

bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ type KubeadmConfigStatus struct {
167167
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmConfig"
168168

169169
// KubeadmConfig is the Schema for the kubeadmconfigs API.
170-
// +Metrics:namePrefix="capi_kubeadmconfig"
170+
// +Metrics:gvk:namePrefix="capi_kubeadmconfig"
171171
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
172172
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
173173
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ type LastRemediationStatus struct {
339339
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=".spec.version",description="Kubernetes version associated with this control plane"
340340

341341
// KubeadmControlPlane is the Schema for the KubeadmControlPlane API.
342-
// +Metrics:namePrefix="capi_kubeadmcontrolplane"
342+
// +Metrics:gvk:namePrefix="capi_kubeadmcontrolplane"
343343
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.ownerReferences.\[kind=Cluster\].name
344344
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
345345
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"

exp/api/v1beta1/machinepool_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func (m *MachinePoolStatus) GetTypedPhase() MachinePoolPhase {
229229
// +k8s:conversion-gen=false
230230

231231
// MachinePool is the Schema for the machinepools API.
232-
// +Metrics:namePrefix="capi_machinepool"
232+
// +Metrics:gvk:namePrefix="capi_machinepool"
233233
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
234234
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
235235
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"

hack/observability/kube-state-metrics/crd-config.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,12 @@ spec:
584584
info:
585585
labelsFromPath:
586586
node_name:
587-
- status
588-
- nodeRef
589-
- name
587+
- name
590588
node_uid:
589+
- uid
590+
path:
591591
- status
592592
- nodeRef
593-
- uid
594593
type: Info
595594
- name: status_phase
596595
help: The machines current phase.
@@ -926,22 +925,24 @@ spec:
926925
info:
927926
# TODO: added metadata.name even it's already defined above as the metric doesn't work with empty labelsFromPath.
928927
labelsFromPath:
929-
name:
930-
- metadata
931-
- name
928+
maxUnhealthy:
929+
- spec
930+
- maxUnhealthy
932931
type: Info
933932
- name: status_current_healthy
934933
help: Current number of healthy machines.
935934
each:
936935
gauge:
936+
nilIsZero: true
937937
path:
938938
- status
939939
- currentHealthy
940940
type: Gauge
941941
- name: status_expected_machines
942-
help: Total number of pods counted by this machinehealthcheck.
942+
help: Total number of machines counted by this machinehealthcheck.
943943
each:
944944
gauge:
945+
nilIsZero: true
945946
path:
946947
- status
947948
- expectedMachines
@@ -950,6 +951,7 @@ spec:
950951
help: Number of machine remediations that are currently allowed.
951952
each:
952953
gauge:
954+
nilIsZero: true
953955
path:
954956
- status
955957
- remediationsAllowed
@@ -1104,6 +1106,7 @@ spec:
11041106
path:
11051107
- status
11061108
- fullyLabeledReplicas
1109+
nilIsZero: true
11071110
type: Gauge
11081111
- name: status_replicas_ready
11091112
help: The number of ready replicas per machineset.
@@ -1256,6 +1259,7 @@ spec:
12561259
nilIsZero: true
12571260
type: Gauge
12581261
- name: info
1262+
help: Information about a machinepool.
12591263
each:
12601264
type: Info
12611265
info:

0 commit comments

Comments
 (0)