kubernetes-sigs / cli-utils

This repo contains binaries that built from libraries in cli-runtime.
Apache License 2.0
155 stars 77 forks source link

kstatus does not accept booleans for conditions #596

Open tim-jagenberg-piscada opened 2 years ago

tim-jagenberg-piscada commented 2 years ago

Some resources use YAML booleans in their status conditions which are not interpreted by kstatus.

Kstatus should interpret both string and boolean representations for conditions.

For example the new Keycloak Operator uses booleans:

status:
  conditions:
    - message: ''
      status: true
      type: Ready
    - message: ''
      status: false
      type: HasErrors
    - message: ''
      status: false
      type: RollingUpdate

This leads to the resource never being considered reconciled by Flux.

karlkfi commented 2 years ago

That seems pretty non-standard. The convention is documented here: https://github.com/zecke/Kubernetes/blob/master/docs/devel/api-conventions.md#typical-status-properties

They're deliberately strings to allow for "Unknown". In this case, "Unknown" also helps improve the UX and error messages without having to hard code that nil means unknown. It's also a relatively common K8s convention to use string enums instead of booleans, to avoid needing to change the schema if you ever need to add a new enum value.

I would recommend suggesting to keycloak that they follow the standard convention.

That said, I'm not against adding an exception into kstatus for this weird edge case. But I consider it a feature request, not a bug.

@justinsb what do you think?

tim-jagenberg-piscada commented 2 years ago

I also reported the issue on the Keycloak side as well: https://github.com/keycloak/keycloak/issues/13074

Making kstatus more robust against probable variations in input would be good anyhow.

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

thezanke commented 1 year ago

I'd love to see either a fix on keycloak's side or this feature added to kstatus so my resources can play well together without a bunch of manual workarounds.

If it helps grease the wheels of value here, eksctl is the official AWS-suggested way to spin up new EKS clusters. Also, eksctl now ships with partial support for setting up GitOps with Flux2 out of the box; so you'll only be hearing/seeing more of this from EKS users.

Thanks.

nick4fake commented 1 year ago

@karlkfi Tim suggested supporting both boolean and strings, I don't see how it really affects "Unknown".

I mean, it even makes much more sense - why does it use "True"/"False" strings now, but doesn't support booleans? The check should probably be trivial:

k8s-triage-robot commented 2 months ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted