Skip to content

Commit 48f268a

Browse files
authored
Merge pull request #7886 from bavarianbidi/improve_custom_resource_metrics_configuration
🌱 improves the existing capi metrics
2 parents bceed3f + 938d9d3 commit 48f268a

File tree

10 files changed

+397
-25
lines changed

10 files changed

+397
-25
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ generate-metrics-config: $(ENVSUBST_BIN) ## Generate ./hack/observability/kube-s
524524
METRICS_DIR="${OBSERVABILITY_DIR}/kube-state-metrics/metrics"; \
525525
echo "# This file was auto-generated via: make generate-metrics-config" > "$${OUTPUT_FILE}"; \
526526
cat "$${METRICS_DIR}/header.yaml" >> "$${OUTPUT_FILE}"; \
527-
for resource in cluster kubeadmcontrolplane machine machinedeployment machinehealthcheck machineset; do \
527+
for resource in cluster kubeadmcontrolplane machine machinedeployment machinehealthcheck machineset machinepool; do \
528528
cat "$${METRICS_DIR}/$${resource}.yaml"; \
529529
RESOURCE="$${resource}" ${ENVSUBST_BIN} < "$${METRICS_DIR}/common_metrics.yaml"; \
530530
if [[ "$${resource}" != "cluster" ]]; then \

api/v1beta1/common_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const (
146146

147147
// MachineAddress contains information for the node's address.
148148
type MachineAddress struct {
149-
// Machine address type, one of Hostname, ExternalIP or InternalIP.
149+
// Machine address type, one of Hostname, ExternalIP, InternalIP, ExternalDNS or InternalDNS.
150150
Type MachineAddressType `json:"type"`
151151

152152
// The machine address.

api/v1beta1/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cluster.x-k8s.io_machines.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 221 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ spec:
3939
- spec
4040
- controlPlaneEndpoint
4141
- port
42+
control_plane_reference_kind:
43+
- spec
44+
- controlPlaneRef
45+
- kind
46+
control_plane_reference_name:
47+
- spec
48+
- controlPlaneRef
49+
- name
50+
infrastructure_reference_kind:
51+
- spec
52+
- infrastructureRef
53+
- kind
54+
infrastructure_reference_name:
55+
- spec
56+
- infrastructureRef
57+
- name
4258
type: Info
4359
- name: spec_paused
4460
help: Whether the cluster is paused and any of its resources will not be processed by the controllers.
@@ -264,24 +280,48 @@ spec:
264280
each:
265281
info:
266282
labelsFromPath:
283+
container_runtime_version:
284+
- status
285+
- nodeInfo
286+
- containerRuntimeVersion
267287
failure_domain:
268288
- spec
269289
- failureDomain
270-
internal_ip:
290+
kernel_version:
271291
- status
272-
- addresses
273-
- "[type=InternalIP]"
274-
- address
292+
- nodeInfo
293+
- kernelVersion
294+
kubelet_version:
295+
- status
296+
- nodeInfo
297+
- kubeletVersion
298+
kube_proxy_version:
299+
- status
300+
- nodeInfo
301+
- kubeProxyVersion
302+
os_image:
303+
- status
304+
- nodeInfo
305+
- osImage
275306
provider_id:
276307
- spec
277308
- providerID
278309
version:
279310
- spec
280311
- version
281-
containerRuntimeVersion:
282-
- status
283-
- nodeInfo
284-
- containerRuntimeVersion
312+
type: Info
313+
- name: addresses
314+
help: Address information about a machine.
315+
each:
316+
info:
317+
path:
318+
- status
319+
- addresses
320+
labelsFromPath:
321+
type:
322+
- type
323+
address:
324+
- address
285325
type: Info
286326
- name: status_noderef
287327
help: Information about the node reference of a machine.
@@ -753,3 +793,176 @@ spec:
753793
- metadata
754794
- ownerReferences
755795
type: Info
796+
- groupVersionKind:
797+
group: cluster.x-k8s.io
798+
kind: MachinePool
799+
version: v1beta1
800+
labelsFromPath:
801+
cluster_name:
802+
- spec
803+
- clusterName
804+
name:
805+
- metadata
806+
- name
807+
namespace:
808+
- metadata
809+
- namespace
810+
uid:
811+
- metadata
812+
- uid
813+
metricNamePrefix: capi_machinepool
814+
metrics:
815+
- name: spec_replicas
816+
help: The number of desired machines for a machinepool.
817+
each:
818+
gauge:
819+
path:
820+
- spec
821+
- replicas
822+
type: Gauge
823+
- name: status_replicas
824+
help: The number of replicas per machinepool.
825+
each:
826+
gauge:
827+
path:
828+
- status
829+
- replicas
830+
nilIsZero: true
831+
type: Gauge
832+
- name: status_replicas_ready
833+
help: The number of ready replicas per machinepool.
834+
each:
835+
gauge:
836+
path:
837+
- status
838+
- readyReplicas
839+
nilIsZero: true
840+
type: Gauge
841+
- name: status_replicas_available
842+
help: The number of available replicas per machinepool.
843+
each:
844+
gauge:
845+
path:
846+
- status
847+
- availableReplicas
848+
nilIsZero: true
849+
type: Gauge
850+
- name: status_replicas_unavailable
851+
help: The number of unavailable replicas per machinepool.
852+
each:
853+
gauge:
854+
path:
855+
- status
856+
- unavailableReplicas
857+
nilIsZero: true
858+
type: Gauge
859+
- name: info
860+
each:
861+
type: Info
862+
info:
863+
labelsFromPath:
864+
infrastructure_reference_name:
865+
- spec
866+
- template
867+
- spec
868+
- infrastructureRef
869+
- name
870+
infrastructure_reference_kind:
871+
- spec
872+
- template
873+
- spec
874+
- infrastructureRef
875+
- kind
876+
bootstrap_configuration_reference_name:
877+
- spec
878+
- template
879+
- spec
880+
- bootstrap
881+
- configRef
882+
- name
883+
bootstrap_configuration_reference_kind:
884+
- spec
885+
- template
886+
- spec
887+
- bootstrap
888+
- configRef
889+
- kind
890+
failure_domain:
891+
- spec
892+
- template
893+
- spec
894+
- failureDomain
895+
version:
896+
- spec
897+
- template
898+
- spec
899+
- version
900+
- name: status_phase
901+
help: The machinepools current phase.
902+
each:
903+
stateSet:
904+
labelName: phase
905+
list:
906+
- ScalingUp
907+
- ScalingDown
908+
- Running
909+
- Failed
910+
- Unknown
911+
path:
912+
- status
913+
- phase
914+
type: StateSet
915+
- name: created
916+
help: Unix creation timestamp.
917+
each:
918+
gauge:
919+
path:
920+
- metadata
921+
- creationTimestamp
922+
type: Gauge
923+
- name: annotation_paused
924+
help: Whether the machinepool is paused and any of its resources will not be processed by the controllers.
925+
each:
926+
info:
927+
path:
928+
- metadata
929+
- annotations
930+
- cluster.x-k8s.io/paused
931+
labelsFromPath:
932+
paused_value: []
933+
type: Info
934+
- name: status_condition
935+
help: The condition of a machinepool.
936+
each:
937+
stateSet:
938+
labelName: status
939+
labelsFromPath:
940+
type:
941+
- type
942+
list:
943+
- 'True'
944+
- 'False'
945+
- Unknown
946+
path:
947+
- status
948+
- conditions
949+
valueFrom:
950+
- status
951+
type: StateSet
952+
- name: owner
953+
help: Owner references.
954+
each:
955+
info:
956+
labelsFromPath:
957+
owner_is_controller:
958+
- controller
959+
owner_kind:
960+
- kind
961+
owner_name:
962+
- name
963+
owner_uid:
964+
- uid
965+
path:
966+
- metadata
967+
- ownerReferences
968+
type: Info

hack/observability/kube-state-metrics/metrics/cluster.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@
3535
- spec
3636
- controlPlaneEndpoint
3737
- port
38+
control_plane_reference_kind:
39+
- spec
40+
- controlPlaneRef
41+
- kind
42+
control_plane_reference_name:
43+
- spec
44+
- controlPlaneRef
45+
- name
46+
infrastructure_reference_kind:
47+
- spec
48+
- infrastructureRef
49+
- kind
50+
infrastructure_reference_name:
51+
- spec
52+
- infrastructureRef
53+
- name
3854
type: Info
3955
- name: spec_paused
4056
help: Whether the cluster is paused and any of its resources will not be processed by the controllers.

hack/observability/kube-state-metrics/metrics/machine.yaml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,48 @@
2222
each:
2323
info:
2424
labelsFromPath:
25+
container_runtime_version:
26+
- status
27+
- nodeInfo
28+
- containerRuntimeVersion
2529
failure_domain:
2630
- spec
2731
- failureDomain
28-
internal_ip:
32+
kernel_version:
2933
- status
30-
- addresses
31-
- "[type=InternalIP]"
32-
- address
34+
- nodeInfo
35+
- kernelVersion
36+
kubelet_version:
37+
- status
38+
- nodeInfo
39+
- kubeletVersion
40+
kube_proxy_version:
41+
- status
42+
- nodeInfo
43+
- kubeProxyVersion
44+
os_image:
45+
- status
46+
- nodeInfo
47+
- osImage
3348
provider_id:
3449
- spec
3550
- providerID
3651
version:
3752
- spec
3853
- version
39-
containerRuntimeVersion:
40-
- status
41-
- nodeInfo
42-
- containerRuntimeVersion
54+
type: Info
55+
- name: addresses
56+
help: Address information about a machine.
57+
each:
58+
info:
59+
path:
60+
- status
61+
- addresses
62+
labelsFromPath:
63+
type:
64+
- type
65+
address:
66+
- address
4367
type: Info
4468
- name: status_noderef
4569
help: Information about the node reference of a machine.

0 commit comments

Comments
 (0)