-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(metric-gen): Implement metric-gen tool to create custom resource configuration from markers #2014
Conversation
027e03d
to
e37da20
Compare
Happy to gather early feedback on this. The work is mostly based on what metrics got defined for Cluster API's resources. |
Example usage: PATH_TO_CAPI_FORK=/some/path
metric-gen \
"${PATH_TO_CAPI_FORK}/bootstrap/kubeadm/api/v1beta1" \
"${PATH_TO_CAPI_FORK}/controlplane/kubeadm/api/v1beta1" \
"${PATH_TO_CAPI_FORK}/api/v1beta1" \
"${PATH_TO_CAPI_FORK}/exp/api/v1beta1" \
> metrics.yaml |
moving to draft after seeing that ci is happy for now |
Thanks @chrischdi for submitting this! Unfortunately it seems like every maintainer is quite busy, I hope to get a chance to review it next week and provide better feedback. |
No worries :-) I also did not get into the open points yet 👍 |
This comment was marked as resolved.
This comment was marked as resolved.
e37da20
to
4099dcf
Compare
4099dcf
to
d7d5ef2
Compare
Note: currently reviving this PR 🎉 Currently works for CAPI and CAPV:
Result configuration: spec:
resources:
- errorLogV: 0
groupVersionKind:
group: bootstrap.cluster.x-k8s.io
kind: KubeadmConfig
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_kubeadmconfig
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the kubeadmconfig is paused and any of its resources will not
be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
name:
- metadata
- name
path: null
type: Info
help: Information about a kubeadmconfig.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a kubeadmconfig.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a kubeadmconfig.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: Cluster
version: v1beta1
labelsFromPath:
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_cluster
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the cluster is paused and any of its resources will not be processed
by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
control_plane_endpoint_host:
- spec
- controlPlaneEndpoint
- host
control_plane_endpoint_port:
- 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
topology_class:
- spec
- topology
- class
topology_version:
- spec
- topology
- version
path: null
type: Info
help: Information about a cluster.
name: info
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- spec
- paused
valueFrom: null
type: Gauge
help: Whether the cluster is paused and any of its resources will not be processed
by the controllers.
name: spec_paused
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a cluster.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a cluster.
name: status_condition_last_transition_time
- each:
stateSet:
labelName: phase
list:
- Pending
- Provisioning
- Provisioned
- Deleting
- Failed
- Unknown
path:
- status
- phase
valueFrom: null
type: StateSet
help: The clusters current phase.
name: status_phase
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: ClusterClass
version: v1beta1
labelsFromPath:
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_clusterclass
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the clusterclass is paused and any of its resources will not be
processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
name:
- metadata
- name
path: null
type: Info
help: Information about a clusterclass.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a clusterclass.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a clusterclass.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: Machine
version: v1beta1
labelsFromPath:
cluster_name:
- spec
- clusterName
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_machine
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
address:
- address
type:
- type
path:
- status
- addresses
type: Info
help: Address information about a machine.
name: addresses
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the machine is paused and any of its resources will not be processed
by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
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
path: null
type: Info
help: Information about a machine.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- certificatesExpiryDate
valueFrom: null
type: Gauge
help: Information about certificate expiration date of a control plane node.
name: status_certificatesexpirydate
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a machine.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a machine.
name: status_condition_last_transition_time
- each:
info:
labelFromKey: ""
labelsFromPath:
node_name:
- name
node_uid:
- uid
path:
- status
- nodeRef
type: Info
help: Information about the node reference of a machine.
name: status_noderef
- each:
stateSet:
labelName: phase
list:
- Pending
- Provisioning
- Provisioned
- Running
- Deleting
- Deleted
- Failed
- Unknown
path:
- status
- phase
valueFrom: null
type: StateSet
help: The machines current phase.
name: status_phase
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: MachineDeployment
version: v1beta1
labelsFromPath:
cluster_name:
- spec
- clusterName
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_machinedeployment
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the machinedeployment is paused and any of its resources will
not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
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
path: null
type: Info
help: Information about a machinedeployment.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- spec
- paused
valueFrom: null
type: Gauge
help: Whether the machinedeployment is paused and any of its resources will
not be processed by the controllers.
name: spec_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- replicas
valueFrom: null
type: Gauge
help: The number of desired machines for a machinedeployment.
name: spec_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- strategy
- rollingUpdate
- maxSurge
valueFrom: null
type: Gauge
help: Maximum number of replicas that can be scheduled above the desired number
of replicas during a rolling update of a machinedeployment.
name: spec_strategy_rollingupdate_max_surge
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- strategy
- rollingUpdate
- maxUnavailable
valueFrom: null
type: Gauge
help: Maximum number of unavailable replicas during a rolling update of a machinedeployment.
name: spec_strategy_rollingupdate_max_unavailable
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a machinedeployment.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a machinedeployment.
name: status_condition_last_transition_time
- each:
stateSet:
labelName: phase
list:
- ScalingUp
- ScalingDown
- Running
- Failed
- Unknown
path:
- status
- phase
valueFrom: null
type: StateSet
help: The machinedeployments current phase.
name: status_phase
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- replicas
valueFrom: null
type: Gauge
help: The number of replicas per machinedeployment.
name: status_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- availableReplicas
valueFrom: null
type: Gauge
help: The number of available replicas per machinedeployment.
name: status_replicas_available
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- readyReplicas
valueFrom: null
type: Gauge
help: The number of ready replicas per machinedeployment.
name: status_replicas_ready
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- unavailableReplicas
valueFrom: null
type: Gauge
help: The number of unavailable replicas per machinedeployment.
name: status_replicas_unavailable
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- updatedReplicas
valueFrom: null
type: Gauge
help: The number of updated replicas per machinedeployment.
name: status_replicas_updated
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: MachineHealthCheck
version: v1beta1
labelsFromPath:
cluster_name:
- spec
- clusterName
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_machinehealthcheck
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the machinehealthcheck is paused and any of its resources will
not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
maxUnhealthy:
- spec
- maxUnhealthy
path: null
type: Info
help: Information about a machinehealthcheck.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a machinehealthcheck.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a machinehealthcheck.
name: status_condition_last_transition_time
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- currentHealthy
valueFrom: null
type: Gauge
help: Current number of healthy machines.
name: status_current_healthy
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- expectedMachines
valueFrom: null
type: Gauge
help: Total number of machines counted by this machinehealthcheck.
name: status_expected_machines
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- remediationsAllowed
valueFrom: null
type: Gauge
help: Number of machine remediations that are currently allowed.
name: status_remediations_allowed
resourcePlural: ""
- errorLogV: 0
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:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the machinepool is paused and any of its resources will not be
processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
bootstrap_configuration_reference_kind:
- spec
- template
- spec
- bootstrap
- configRef
- kind
bootstrap_configuration_reference_name:
- spec
- template
- spec
- bootstrap
- configRef
- name
failure_domain:
- spec
- template
- spec
- failureDomain
infrastructure_reference_kind:
- spec
- template
- spec
- infrastructureRef
- kind
infrastructure_reference_name:
- spec
- template
- spec
- infrastructureRef
- name
version:
- spec
- template
- spec
- version
path: null
type: Info
help: Information about a machinepool.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- replicas
valueFrom: null
type: Gauge
help: The number of desired machines for a machinepool.
name: spec_replicas
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a machinepool.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a machinepool.
name: status_condition_last_transition_time
- each:
stateSet:
labelName: phase
list:
- ScalingUp
- ScalingDown
- Running
- Failed
- Unknown
path:
- status
- phase
valueFrom: null
type: StateSet
help: The machinepools current phase.
name: status_phase
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- replicas
valueFrom: null
type: Gauge
help: The number of replicas per machinepool.
name: status_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- availableReplicas
valueFrom: null
type: Gauge
help: The number of available replicas per machinepool.
name: status_replicas_available
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- readyReplicas
valueFrom: null
type: Gauge
help: The number of ready replicas per machinepool.
name: status_replicas_ready
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- unavailableReplicas
valueFrom: null
type: Gauge
help: The number of unavailable replicas per machinepool.
name: status_replicas_unavailable
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: cluster.x-k8s.io
kind: MachineSet
version: v1beta1
labelsFromPath:
cluster_name:
- spec
- clusterName
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_machineset
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the machineset is paused and any of its resources will not be
processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
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
path: null
type: Info
help: Information about a machineset.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- spec
- replicas
valueFrom: null
type: Gauge
help: The number of desired machines for a machineset.
name: spec_replicas
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a machineset.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a machineset.
name: status_condition_last_transition_time
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- replicas
valueFrom: null
type: Gauge
help: The number of replicas per machineset.
name: status_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- availableReplicas
valueFrom: null
type: Gauge
help: The number of available replicas per machineset.
name: status_replicas_available
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- fullyLabeledReplicas
valueFrom: null
type: Gauge
help: The number of fully labeled replicas per machineset.
name: status_replicas_fully_labeled
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- readyReplicas
valueFrom: null
type: Gauge
help: The number of ready replicas per machineset.
name: status_replicas_ready
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: controlplane.cluster.x-k8s.io
kind: KubeadmControlPlane
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- ownerReferences
- '[kind=Cluster]'
- name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capi_kubeadmcontrolplane
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the kubeadmcontrolplane is paused and any of its resources will
not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
version:
- spec
- version
path: null
type: Info
help: Information about a kubeadmcontrolplane.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- replicas
valueFrom: null
type: Gauge
help: The number of desired machines for a kubeadmcontrolplane.
name: spec_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- spec
- rolloutStrategy
- rollingUpdate
- maxSurge
valueFrom: null
type: Gauge
help: Maximum number of replicas that can be scheduled above the desired number
of replicas during a rolling update of a kubeadmcontrolplane.
name: spec_strategy_rollingupdate_max_surge
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a kubeadmcontrolplane.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a kubeadmcontrolplane.
name: status_condition_last_transition_time
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- replicas
valueFrom: null
type: Gauge
help: The number of replicas per kubeadmcontrolplane.
name: status_replicas
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- readyReplicas
valueFrom: null
type: Gauge
help: The number of ready replicas per kubeadmcontrolplane.
name: status_replicas_ready
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- unavailableReplicas
valueFrom: null
type: Gauge
help: The number of unavailable replicas per kubeadmcontrolplane.
name: status_replicas_unavailable
- each:
gauge:
labelFromKey: ""
nilIsZero: true
path:
- status
- updatedReplicas
valueFrom: null
type: Gauge
help: The number of updated replicas per kubeadmcontrolplane.
name: status_replicas_updated
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereCluster
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vspherecluster
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vspherecluster is paused and any of its resources will not
be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
spec_server:
- spec
- server
status_vsphere_version:
- status
- vCenterVersion
path: null
type: Info
help: Information about a vspherecluster.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a vspherecluster.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a vspherecluster.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereClusterIdentity
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vsphereclusteridentity
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vsphereclusteridentity is paused and any of its resources
will not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
name:
- metadata
- name
path: null
type: Info
help: Information about a vsphereclusteridentity.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a vsphereclusteridentity.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a vsphereclusteridentity.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereDeploymentZone
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vspheredeploymentzone
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vspheredeploymentzone is paused and any of its resources will
not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
name:
- metadata
- name
path: null
type: Info
help: Information about a vspheredeploymentzone.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a vspheredeploymentzone.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a vspheredeploymentzone.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereFailureDomain
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vspherefailuredomain
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vspherefailuredomain is paused and any of its resources will
not be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
name:
- metadata
- name
path: null
type: Info
help: Information about a vspherefailuredomain.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereMachine
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vspheremachine
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
address:
- address
type:
- type
path:
- status
- addresses
type: Info
help: Address information about a vspheremachine.
name: addresses
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vspheremachine is paused and any of its resources will not
be processed by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
provider_id:
- spec
- providerID
path: null
type: Info
help: Information about a vspheremachine.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a vspheremachine.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a vspheremachine.
name: status_condition_last_transition_time
resourcePlural: ""
- errorLogV: 0
groupVersionKind:
group: infrastructure.cluster.x-k8s.io
kind: VSphereVM
version: v1beta1
labelsFromPath:
cluster_name:
- metadata
- labels
- cluster.x-k8s.io/cluster-name
name:
- metadata
- name
namespace:
- metadata
- namespace
uid:
- metadata
- uid
metricNamePrefix: capv_vspherevm
metrics:
- each:
info:
labelFromKey: ""
labelsFromPath:
address: []
path:
- status
- addresses
type: Info
help: Address information about a vspherevm.
name: addresses
- each:
info:
labelFromKey: ""
labelsFromPath:
paused_value: []
path:
- metadata
- annotations
- cluster.x-k8s.io/paused
type: Info
help: Whether the vspherevm is paused and any of its resources will not be processed
by the controllers.
name: annotation_paused
- each:
gauge:
labelFromKey: ""
nilIsZero: false
path:
- metadata
- creationTimestamp
valueFrom: null
type: Gauge
help: Unix creation timestamp.
name: created
- each:
info:
labelFromKey: ""
labelsFromPath:
status_clonemode:
- status
- cloneMode
path: null
type: Info
help: Information about a vspherevm.
name: info
- each:
info:
labelFromKey: ""
labelsFromPath:
owner_is_controller:
- controller
owner_kind:
- kind
owner_name:
- name
owner_uid:
- uid
path:
- metadata
- ownerReferences
type: Info
help: Owner references.
name: owner
- each:
stateSet:
labelName: status
labelsFromPath:
type:
- type
list:
- "True"
- "False"
- Unknown
path:
- status
- conditions
valueFrom:
- status
type: StateSet
help: The condition of a vspherevm.
name: status_condition
- each:
gauge:
labelFromKey: ""
labelsFromPath:
status:
- status
type:
- type
nilIsZero: false
path:
- status
- conditions
valueFrom:
- lastTransitionTime
type: Gauge
help: The condition last transition time of a vspherevm.
name: status_condition_last_transition_time
resourcePlural: "" Result metrics sample:
|
860d71a
to
ec46137
Compare
This likely requires feedback from other maintainers:
|
That's great feedback 👍 If we like to do that, the caveat is that we will depend on controller-tools. E.g. the go.mod changes if we would do that would be the following: Edit: see PR diff for up-to-date diff on go.mod diff --git a/go.mod b/go.mod
index 30db0c47..76edc081 100644
--- a/go.mod
+++ b/go.mod
@@ -24,6 +24,8 @@ require (
k8s.io/klog/v2 v2.100.1
k8s.io/sample-controller v0.27.4
k8s.io/utils v0.0.0-20230711102312-30195339c3c7
+ sigs.k8s.io/controller-tools v0.12.0
+ sigs.k8s.io/yaml v1.3.0
)
require (
@@ -34,6 +36,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
+ github.com/fatih/color v1.15.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
@@ -53,6 +56,8 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
+ github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
@@ -69,6 +74,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/crypto v0.9.0 // indirect
+ golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.2.0 // indirect
@@ -76,13 +82,14 @@ require (
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.1.0 // indirect
+ golang.org/x/tools v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
+ k8s.io/apiextensions-apiserver v0.27.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
- sigs.k8s.io/yaml v1.3.0 // indirect
) |
f846c7f
to
26a7d8c
Compare
3ca9aa8
to
3eb664f
Compare
Hey folks, happy to drive this further or shutdown the PR if its not reasonable to get added. |
Great to see this moving forward, IMO this will be a great addition and help move metrics for CRD to the next level (talking from a Cluster API perspective, but many other projects can benefit from this as well) |
Implements the metric-gen tool which could get used to create custom resource configurations directly from code, similar to what controller-gen does.
3eb664f
to
a523a3d
Compare
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/reopen |
@chrischdi: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/close in favor of adding it directly to controller-gen: kubernetes-sigs/controller-tools#1043 |
@chrischdi: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
Implements the metric-gen tool which could get used to create custom resource configurations directly from code, similar to what controller-gen does.
Note: this is a WIP PR and is not finished yet.Ready for reviewIts current state is able to create a full working equivalent for Cluster API's hand-baked manual configuration file when using this Cluster API fork branch which adds the markers to the API types.
Open AI's:
DocumentationHow does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
No change because it does not change kube-state-metrics itself
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1899