Skip to content
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

Custom resource state metrics wildcard not working #2384

Open
akselleirv opened this issue Apr 30, 2024 · 1 comment
Open

Custom resource state metrics wildcard not working #2384

akselleirv opened this issue Apr 30, 2024 · 1 comment
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@akselleirv
Copy link

akselleirv commented Apr 30, 2024

What happened:

Metrics from custom resource is not produced when wildcard is used in kind field.

What you expected to happen:

The wildcard should produce metrics for all kinds.

How to reproduce it (as minimally and precisely as possible):

I have the following helm chart values file

rbac:
  extraRules:
    - apiGroups: ["azure.tnnova.io"]
      resources: ["*"]
      verbs: ["get", "list", "watch"]
    - apiGroups: ["apiextensions.k8s.io"]
      resources: ["customresourcedefinitions"]
      verbs: ["get", "list", "watch"]
customResourceState:
  enabled: true
  config:
    kind: CustomResourceStateMetrics
    spec:
      resources:
        - groupVersionKind:
            group: "azure.tnnova.io"
            version: "v1alpha1"
            kind: "UserAssignedIdentity"
          labelsFromPath:
            namespace: [metadata, namespace]
          metrics:
              - name: status_conditions
                help: "The condition of the resource"
                each:
                  type: StateSet
                  stateSet:
                    path: [status, conditions, "0"]
                    labelName: status
                    valueFrom: [status]
                    list: ["True", "False", "Unknown"]
                    labelsFromPath:
                      type: [type]

It produces the following metrics:

# HELP kube_customresource_status_conditions The condition of the resource
# TYPE kube_customresource_status_conditions stateset
kube_customresource_status_conditions{customresource_group="azure.tnnova.io",customresource_kind="UserAssignedIdentity",customresource_version="v1alpha1",namespace="s01234-example-system",status="False",type="Ready"} 0
kube_customresource_status_conditions{customresource_group="azure.tnnova.io",customresource_kind="UserAssignedIdentity",customresource_version="v1alpha1",namespace="s01234-example-system",status="True",type="Ready"} 1
kube_customresource_status_conditions{customresource_group="azure.tnnova.io",customresource_kind="UserAssignedIdentity",customresource_version="v1alpha1",namespace="s01234-example-system",status="Unknown",type="Ready"} 0

However, when I replace kind="UserAssignedIdentity" to kind="*" , like:

...
        - groupVersionKind:
            group: "azure.tnnova.io"
            version: "v1alpha1"
            kind: "*"
...

Then it no longer produces any metrics. I have verified that the kube-state-metrics service account has list,watch,get on customresourcedefintions.

Anything else we need to know?:

Environment:

  • kube-state-metrics version: 2.12.0
  • Kubernetes version (use kubectl version): v1.30.0
  • Cloud provider or hardware configuration: kind
  • Other info:
@akselleirv akselleirv added the kind/bug Categorizes issue or PR as related to a bug. label Apr 30, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 30, 2024
@logicalhan
Copy link
Member

/triage accepted
/assign @rexagod

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants