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

HRQ decimal point value cannot be specified #292

Closed
mochizuki875 opened this issue May 31, 2023 · 5 comments
Closed

HRQ decimal point value cannot be specified #292

mochizuki875 opened this issue May 31, 2023 · 5 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@mochizuki875
Copy link
Member

What happened?

In HierarchicalResourceQuota, decimal point value cannot be specified.
It's allowed in ResourceQuota.

What did you expect to happen?

Decimal point value can be specified as ResourceQuota

How can we reproduce it (as minimally and precisely as possible)?

For example, this will be invalid.

test-hrq.yaml

apiVersion: hnc.x-k8s.io/v1alpha2
kind: HierarchicalResourceQuota
metadata:
  name: test-hrq
  namespace: test
spec:
  hard:
    limits.cpu: 1.5	# invalid 
    limits.memory: 500Mi
    requests.cpu: 1
    requests.memory: 200Mi
$ kubectl apply -f test-hrq.yaml 
The HierarchicalResourceQuota "test-hrq" is invalid: 
* spec.hard.limits.cpu: Invalid value: "number": spec.hard.limits.cpu in body must be of type integer,string: "number"
* <nil>: Invalid value: "": "spec.hard.limits.cpu" must validate at least one schema (anyOf)
* spec.hard.limits.cpu: Invalid value: "number": spec.hard.limits.cpu in body must be of type integer: "number"

If set limits.cpu: "1.5", it works.

@mochizuki875
Copy link
Member Author

mochizuki875 commented May 31, 2023

I couldn't understand the details, but at least it seems that ResourceQuota.spec.hard and HierarchicalResourceQuota.spec.hard are not exactly the same.

ResourceQuota.spec.hard

$ kubectl explain --recursive ResourceQuota.spec.hard 
KIND:       ResourceQuota
VERSION:    v1

FIELD: hard <map[string]Quantity>:

DESCRIPTION:

HierarchicalResourceQuota.spec.hard

$ kubectl explain --recursive HierarchicalResourceQuota.spec.hard
GROUP:      hnc.x-k8s.io
KIND:       HierarchicalResourceQuota
VERSION:    v1alpha2

FIELD: hard <map[string]Object>:

DESCRIPTION:

We reuse the k8s parsing code in hierarchicalresourcequota_types.go.

// HierarchicalResourceQuotaSpec defines the desired hard limits to enforce for
// a namespace and descendant namespaces
type HierarchicalResourceQuotaSpec struct {
// Hard is the set of desired hard limits for each named resource
// +optional
Hard corev1.ResourceList `json:"hard,omitempty"`
}

The ResourceQuota's definition is that.

https://github.com/kubernetes/api/blob/1bc03f6ff533896e6c57e5032babe7bdc39848fb/core/v1/types.go#L6267-L6282

However, generated CRD defines the HierarchicalResourceQuota.spec.hard as integer or string.

spec:
description: Spec defines the desired quota
properties:
hard:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Hard is the set of desired hard limits for each named
resource
type: object
type: object

So it might have something to do with the process of converting _types.go to CRD by controller-gen.
(Maybe it's a CRD constraint?)

@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 21, 2024
@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 20, 2024
@k8s-triage-robot
Copy link

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

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close not-planned

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

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

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

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

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants