Skip to content

Commit

Permalink
Merge pull request #7886 from bavarianbidi/improve_custom_resource_me…
Browse files Browse the repository at this point in the history
…trics_configuration

🌱 improves the existing capi metrics
  • Loading branch information
k8s-ci-robot authored Jan 13, 2023
2 parents bceed3f + 938d9d3 commit 48f268a
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ generate-metrics-config: $(ENVSUBST_BIN) ## Generate ./hack/observability/kube-s
METRICS_DIR="${OBSERVABILITY_DIR}/kube-state-metrics/metrics"; \
echo "# This file was auto-generated via: make generate-metrics-config" > "$${OUTPUT_FILE}"; \
cat "$${METRICS_DIR}/header.yaml" >> "$${OUTPUT_FILE}"; \
for resource in cluster kubeadmcontrolplane machine machinedeployment machinehealthcheck machineset; do \
for resource in cluster kubeadmcontrolplane machine machinedeployment machinehealthcheck machineset machinepool; do \
cat "$${METRICS_DIR}/$${resource}.yaml"; \
RESOURCE="$${resource}" ${ENVSUBST_BIN} < "$${METRICS_DIR}/common_metrics.yaml"; \
if [[ "$${resource}" != "cluster" ]]; then \
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const (

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

// The machine address.
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/crd/bases/cluster.x-k8s.io_machines.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

229 changes: 221 additions & 8 deletions hack/observability/kube-state-metrics/crd-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ spec:
- spec
- controlPlaneEndpoint
- port
control_plane_reference_kind:
- spec
- controlPlaneRef
- kind
control_plane_reference_name:
- spec
- controlPlaneRef
- name
infrastructure_reference_kind:
- spec
- infrastructureRef
- kind
infrastructure_reference_name:
- spec
- infrastructureRef
- name
type: Info
- name: spec_paused
help: Whether the cluster is paused and any of its resources will not be processed by the controllers.
Expand Down Expand Up @@ -264,24 +280,48 @@ spec:
each:
info:
labelsFromPath:
container_runtime_version:
- status
- nodeInfo
- containerRuntimeVersion
failure_domain:
- spec
- failureDomain
internal_ip:
kernel_version:
- status
- addresses
- "[type=InternalIP]"
- address
- nodeInfo
- kernelVersion
kubelet_version:
- status
- nodeInfo
- kubeletVersion
kube_proxy_version:
- status
- nodeInfo
- kubeProxyVersion
os_image:
- status
- nodeInfo
- osImage
provider_id:
- spec
- providerID
version:
- spec
- version
containerRuntimeVersion:
- status
- nodeInfo
- containerRuntimeVersion
type: Info
- name: addresses
help: Address information about a machine.
each:
info:
path:
- status
- addresses
labelsFromPath:
type:
- type
address:
- address
type: Info
- name: status_noderef
help: Information about the node reference of a machine.
Expand Down Expand Up @@ -753,3 +793,176 @@ spec:
- metadata
- ownerReferences
type: Info
- groupVersionKind:
group: cluster.x-k8s.io
kind: MachinePool
version: v1beta1
labelsFromPath:
cluster_name:
- spec
- clusterName
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_machinepool
metrics:
- name: spec_replicas
help: The number of desired machines for a machinepool.
each:
gauge:
path:
- spec
- replicas
type: Gauge
- name: status_replicas
help: The number of replicas per machinepool.
each:
gauge:
path:
- status
- replicas
nilIsZero: true
type: Gauge
- name: status_replicas_ready
help: The number of ready replicas per machinepool.
each:
gauge:
path:
- status
- readyReplicas
nilIsZero: true
type: Gauge
- name: status_replicas_available
help: The number of available replicas per machinepool.
each:
gauge:
path:
- status
- availableReplicas
nilIsZero: true
type: Gauge
- name: status_replicas_unavailable
help: The number of unavailable replicas per machinepool.
each:
gauge:
path:
- status
- unavailableReplicas
nilIsZero: true
type: Gauge
- name: info
each:
type: Info
info:
labelsFromPath:
infrastructure_reference_name:
- spec
- template
- spec
- infrastructureRef
- name
infrastructure_reference_kind:
- spec
- template
- spec
- infrastructureRef
- kind
bootstrap_configuration_reference_name:
- spec
- template
- spec
- bootstrap
- configRef
- name
bootstrap_configuration_reference_kind:
- spec
- template
- spec
- bootstrap
- configRef
- kind
failure_domain:
- spec
- template
- spec
- failureDomain
version:
- spec
- template
- spec
- version
- name: status_phase
help: The machinepools current phase.
each:
stateSet:
labelName: phase
list:
- ScalingUp
- ScalingDown
- Running
- Failed
- Unknown
path:
- status
- phase
type: StateSet
- name: created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: annotation_paused
help: Whether the machinepool is paused and any of its resources will not be processed by the controllers.
each:
info:
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
labelsFromPath:
paused_value: []
type: Info
- name: status_condition
help: The condition of a machinepool.
each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- 'True'
- 'False'
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
- name: owner
help: Owner references.
each:
info:
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
16 changes: 16 additions & 0 deletions hack/observability/kube-state-metrics/metrics/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@
- spec
- controlPlaneEndpoint
- port
control_plane_reference_kind:
- spec
- controlPlaneRef
- kind
control_plane_reference_name:
- spec
- controlPlaneRef
- name
infrastructure_reference_kind:
- spec
- infrastructureRef
- kind
infrastructure_reference_name:
- spec
- infrastructureRef
- name
type: Info
- name: spec_paused
help: Whether the cluster is paused and any of its resources will not be processed by the controllers.
Expand Down
40 changes: 32 additions & 8 deletions hack/observability/kube-state-metrics/metrics/machine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,48 @@
each:
info:
labelsFromPath:
container_runtime_version:
- status
- nodeInfo
- containerRuntimeVersion
failure_domain:
- spec
- failureDomain
internal_ip:
kernel_version:
- status
- addresses
- "[type=InternalIP]"
- address
- nodeInfo
- kernelVersion
kubelet_version:
- status
- nodeInfo
- kubeletVersion
kube_proxy_version:
- status
- nodeInfo
- kubeProxyVersion
os_image:
- status
- nodeInfo
- osImage
provider_id:
- spec
- providerID
version:
- spec
- version
containerRuntimeVersion:
- status
- nodeInfo
- containerRuntimeVersion
type: Info
- name: addresses
help: Address information about a machine.
each:
info:
path:
- status
- addresses
labelsFromPath:
type:
- type
address:
- address
type: Info
- name: status_noderef
help: Information about the node reference of a machine.
Expand Down
Loading

0 comments on commit 48f268a

Please sign in to comment.