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

Support for Unknown status condition in Custom Resources #2070

Open
EronWright opened this issue May 17, 2023 · 4 comments
Open

Support for Unknown status condition in Custom Resources #2070

EronWright opened this issue May 17, 2023 · 4 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@EronWright
Copy link

What would you like to be added:
Improve support for producing a gauge for the status conditions of a custom resource, when the condition status is Unknown. Today, the data point cannot be produced due to a parse error:

[status,conditions]: [1]: [status]: strconv.ParseFloat: parsing \"Unknown\": invalid syntax

The gauge definition is:

    - name: "foo_status"
      help: "status condition "
      each:
        type: Gauge
        gauge:
          path: [status, conditions]
          labelsFromPath:
            type: ["type"]
          valueFrom: ["status"]

Why is this needed:
This is needed to round out the support for status conditions. Unknown is a legit status value and should be supported.

Describe the solution you'd like
it isn't totally clear what the gauge value should be. Here's a couple of options:

  1. Don't report an error message and skip reporting the data point. This means that Unknown would translate into the absence of a data point.
  2. Consider adding a valueMap structure to map the status values to a numerical value, e.g.
    - name: "foo_status"
      help: "status condition "
      each:
        type: Gauge
        gauge:
          path: [status, conditions]
          labelsFromPath:
            type: ["type"]
          valueFrom: ["status"]
          valueMap:
            - {from: "Unknown", to: 0}
            - {from: "True", to: 1}
            - {from: "False", to: 0}
@EronWright EronWright added the kind/feature Categorizes issue or PR as related to a new feature. label May 17, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 17, 2023
@CatherineF-dev
Copy link
Contributor

A related issue #1978, so that you can use cel to extract what you want.

@dgrisonnet
Copy link
Member

/triage accepted
/assign @CatherineF-dev

@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 Jun 29, 2023
@robbie-demuth
Copy link

robbie-demuth commented Oct 25, 2023

I just ran into this issue and was able to workaround it by using a StateSet

- name: status_condition
  each:
    type: StateSet
    stateSet:
      path: [status, conditions]
      labelName: status
      valueFrom: [status]
      list: [True, False, Unknown]
      labelsFromPath:
        type: [type]

@defenestration
Copy link

I just ran into this issue and was able to workaround it by using a StateSet

- name: status_condition
  each:
    type: StateSet
    stateSet:
      path: [status, conditions]
      labelName: status
      valueFrom: [status]
      list: [True, False, Unknown]
      labelsFromPath:
        type: [type]

I feel like this suggestion should go into the docs here. Currently suggests using a Gauge for the status.conditions but this doesn't capture the 'unknown' status as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants