- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.1k
 
Open
Labels
kind/supportCategorizes issue or PR as a support question.Categorizes issue or PR as a support question.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
What happened:
I defined  configuration for Custom Resource State Metrics for my three CRD's (ReplicationGroup, ClusterInstance, RDSInstance)
After deploying it to cluster where I have kubernetes objects of all above types kube-state-metric is producing me expected crossplane_engine_version metric
But when I deploy same configuration to the cluster where I have only objects of RDSInstance type, crossplane_engine_version metric is missing
What you expected to happen:
Metric should be produced by kube-state-metric even if there are no real Objects of one type/kind listed in configuration below
How to reproduce it (as minimally and precisely as possible):
apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-state-metrics-crd-config
  namespace: crossplane-system
data:
  crd-config.yaml: |
    kind: CustomResourceStateMetrics
    spec:
      resources:
        - groupVersionKind:
            group: cache.aws.crossplane.io
            version: "*"
            kind: ReplicationGroup
          metricNamePrefix: crossplane
          labelsFromPath:
            managedResourceKind: [kind]
            claimKind: [metadata, ownerReferences, "[controller=true]", kind]
            cllaimName: [metadata, labels, crossplane.io/claim-name]
            claimNamespace: [metadata, labels, crossplane.io/claim-namespace]
          metrics:
            - name: "engine_version"
              help: "Engine Version"
              each:
                type: Info
                info:
                  labelsFromPath:
                    engineVersion: [spec, forProvider, engineVersion]
              commonLabels:
                custom_metric: "yes"
        - groupVersionKind:
            group: rds.aws.upbound.io
            version: "*"
            kind: ClusterInstance
          metricNamePrefix: crossplane
          labelsFromPath:
            managedResourceKind: [kind]
            claimKind: [metadata, ownerReferences, "[controller=true]", kind]
            cllaimName: [metadata, labels, crossplane.io/claim-name]
            claimNamespace: [metadata, labels, crossplane.io/claim-namespace]
          metrics:
            - name: "engine_version"
              help: "Engine Version"
              each:
                type: Info
                info:
                  labelsFromPath:
                    engineVersion: [status, atProvider, engineVersion]
              commonLabels:
                custom_metric: "yes"
        - groupVersionKind:
            group: database.aws.crossplane.io
            version: "*"
            kind: RDSInstance
          metricNamePrefix: crossplane
          labelsFromPath:
            managedResourceKind: [kind]
            claimKind: [metadata, ownerReferences, "[controller=true]", kind]
            cllaimName: [metadata, labels, crossplane.io/claim-name]
            claimNamespace: [metadata, labels, crossplane.io/claim-namespace]
          metrics:
            - name: "engine_version"
              help: "Engine Version"
              each:
                type: Info
                info:
                  labelsFromPath:
                    engineVersion: [spec, forProvider, engineVersion]
              commonLabels:
                custom_metric: "yes"Environment:
- kube-state-metrics version: 
2.12.0 - Kubernetes version: 
v1.28.9 - Cloud provider: 
AWS - Other info:
 
Metadata
Metadata
Assignees
Labels
kind/supportCategorizes issue or PR as a support question.Categorizes issue or PR as a support question.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Type
Projects
Status
Needs Review (PR) or Response (Issue)