Skip to content

Commit

Permalink
feat: add sample kube-state-metrics-config (#75)
Browse files Browse the repository at this point in the history
- Added sample config map for exposing garm-operator cr metrics via
kube-state-metrics agent
- Added documentation on metrics and how to use config

---------

Co-authored-by: Mario Constanti <[email protected]>
  • Loading branch information
rafalgalaw and bavarianbidi authored Feb 29, 2024
1 parent 1e194e5 commit ca4d50d
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 0 deletions.
295 changes: 295 additions & 0 deletions config/kube-state-metrics/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
kind: ConfigMap
apiVersion: v1
metadata:
labels:
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/component: metrics
name: kube-state-metrics-config
namespace: system
data:
config.yaml: |
kind: CustomResourceStateMetrics
spec:
resources:
##################
# ENTERPRISE #
#################
- groupVersionKind:
group: garm-operator.mercedes-benz.com
kind: "Enterprise"
version: "v1alpha1"
metricNamePrefix: garm_operator
commonLabels:
crd_type: "enterprise"
labelsFromPath:
name: [ metadata, name ]
namespace: [ metadata, namespace ]
metrics:
- name: enterprise_created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: enterprise_info
help: Information about an enterprise.
each:
type: Info
info:
labelsFromPath:
credentialsName: [ spec, credentialsName ]
webhookSecretRefKey: [ spec, webhookSecretRef, key ]
webhookSecretRefName: [ spec, webhookSecretRef, name ]
id: [ status, id ]
- name: enterprise_annotation_paused_info
help: Whether the enterprise reconciliation is paused.
each:
type: Info
info:
path:
- metadata
- annotations
- garm-operator.mercedes-benz.com/paused
labelsFromPath:
paused_value: []
- name: enterprise_status_conditions
help: Displays whether status of each possible condition is True or False.
each:
type: Gauge
gauge:
path:
- status
- conditions
valueFrom:
- status
labelFromKey: reason
labelsFromPath:
type: [ type ]
##################
# Org #
#################
- groupVersionKind:
group: garm-operator.mercedes-benz.com
kind: "Organization"
version: "v1alpha1"
metricNamePrefix: garm_operator
commonLabels:
crd_type: "organization"
labelsFromPath:
name: [ metadata, name ]
namespace: [ metadata, namespace ]
metrics:
- name: org_created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: org_info
help: Information about an organization.
each:
type: Info
info:
labelsFromPath:
credentialsName: [ spec, credentialsName ]
webhookSecretRefKey: [ spec, webhookSecretRef, key ]
webhookSecretRefName: [ spec, webhookSecretRef, name ]
id: [ status, id ]
- name: org_annotation_paused_info
help: Whether the org reconciliation is paused.
each:
type: Info
info:
path:
- metadata
- annotations
- garm-operator.mercedes-benz.com/paused
labelsFromPath:
paused_value: [ ]
- name: org_status_conditions
help: Displays whether status of each possible condition is True or False.
each:
type: Gauge
gauge:
path:
- status
- conditions
valueFrom:
- status
labelFromKey: reason
labelsFromPath:
type: [ type ]
##################
# Repo #
#################
- groupVersionKind:
group: garm-operator.mercedes-benz.com
kind: "Repository"
version: "v1alpha1"
metricNamePrefix: garm_operator
commonLabels:
crd_type: "repository"
labelsFromPath:
name: [ metadata, name ]
namespace: [ metadata, namespace ]
metrics:
- name: repo_created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: repo_info
help: Information about a repository.
each:
type: Info
info:
labelsFromPath:
owner: [ spec, owner ]
credentialsName: [ spec, credentialsName ]
webhookSecretRefKey: [ spec, webhookSecretRef, key ]
webhookSecretRefName: [ spec, webhookSecretRef, name ]
id: [ status, id ]
- name: repo_annotation_paused_info
help: Whether the repo reconciliation is paused.
each:
type: Info
info:
path:
- metadata
- annotations
- garm-operator.mercedes-benz.com/paused
labelsFromPath:
paused_value: [ ]
- name: repo_status_conditions
help: Displays whether status of each possible condition is True or False.
each:
type: Gauge
gauge:
path:
- status
- conditions
valueFrom:
- status
labelFromKey: reason
labelsFromPath:
type: [ type ]
##################
# Pool #
#################
- groupVersionKind:
group: garm-operator.mercedes-benz.com
kind: "Pool"
version: "v1alpha1"
metricNamePrefix: garm_operator
commonLabels:
crd_type: "pool"
labelsFromPath:
name: [ metadata, name ]
namespace: [ metadata, namespace ]
metrics:
- name: pool_created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: pool_info
help: Information about a pool.
each:
type: Info
info:
labelsFromPath:
enabled: [spec, enabled]
githubRunnerGroup: [spec, githubRunnerGroup]
scopeKind: [spec, githubScopeRef, kind]
scopeName: [spec, githubScopeRef, name]
imageName: [spec, imageName]
maxRunners: [spec, maxRunners]
minIdleRunners: [spec, minIdleRunners]
osArch: [spec, osArch]
osType: [spec, osType]
providerName: [spec, providerName]
runnerBootstrapTimeout: [spec, runnerBootstrapTimeout]
runnerPrefix: [spec, runnerPrefix]
tags: [spec, tags]
id: [status, id]
longRunningIdleRunners: [status, longRunningIdleRunners]
- name: pool_annotation_paused_info
help: Whether the pool reconciliation is paused.
each:
type: Info
info:
path:
- metadata
- annotations
- garm-operator.mercedes-benz.com/paused
labelsFromPath:
paused_value: [ ]
- name: pool_status_conditions
help: Displays whether status of each possible condition is True or False.
each:
type: Gauge
gauge:
path:
- status
- conditions
valueFrom:
- status
labelFromKey: reason
labelsFromPath:
type: [ type ]
##################
# Image #
#################
- groupVersionKind:
group: garm-operator.mercedes-benz.com
kind: "Image"
version: "v1alpha1"
metricNamePrefix: garm_operator
commonLabels:
crd_type: "image"
labelsFromPath:
name: [ metadata, name ]
namespace: [ metadata, namespace ]
metrics:
- name: image_created
help: Unix creation timestamp.
each:
gauge:
path:
- metadata
- creationTimestamp
type: Gauge
- name: image_info
help: Information about an image.
each:
type: Info
info:
labelsFromPath:
tag: [spec, tag]
Loading

0 comments on commit ca4d50d

Please sign in to comment.