kubernetes: Resource Quota doesn't persist/return GenerateName

Kubernetes version (use kubectl version): Latest

Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.1", GitCommit:"b0b7a323cc5a4a2019b2e9520c21c7830b7f708e", GitTreeState:"clean", BuildDate:"2017-04-03T23:37:53Z", GoVersion:"go1.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"7+", GitVersion:"v1.7.0-alpha.0.2604+b22a298009ec79", GitCommit:"b22a298009ec79e7f681ac2ae8070bbcc6fffcd1", GitTreeState:"clean", BuildDate:"2017-04-15T18:41:18Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

Environment:

It’s likely a bug in the API affecting all environments, but I found this while interacting with GKE.

What happened:

After submitting new resource quota with generated name, the resource quota was (correctly) created, but then it didn’t return the generateName attribute back from the API.

What you expected to happen:

Persist & return the generateName attribute from the API for any Resource Quota which has this attribute set.

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

rq.yaml

apiVersion: v1
kind: ResourceQuota
metadata:
  generateName: "myprefix-"
spec:
  hard:
    cpu: "20"
    memory: 1Gi
    pods: "10"
    replicationcontrollers: "20"
    resourcequotas: "1"
    services: "5"
$ kubectl create -f rq.yaml
resourcequota "myprefix-hq2v4" created
$ kubectl get resourcequota myprefix-hq2v4 -o=yaml
apiVersion: v1
kind: ResourceQuota
metadata:
  creationTimestamp: 2017-04-16T10:15:09Z
  name: myprefix-hq2v4
  namespace: default
  resourceVersion: "88928"
  selfLink: /api/v1/namespaces/default/resourcequotas/myprefix-hq2v4
  uid: 92598458-228d-11e7-b6c1-42010a800002
spec:
  hard:
    cpu: "20"
    memory: 1Gi
    pods: "10"
    replicationcontrollers: "20"
    resourcequotas: "1"
    services: "5"
status:
  hard:
    cpu: "20"
    memory: 1Gi
    pods: "10"
    replicationcontrollers: "20"
    resourcequotas: "1"
    services: "5"
  used:
    cpu: "0"
    memory: "0"
    pods: "0"
    replicationcontrollers: "0"
    resourcequotas: "1"
    services: "1"

Here’s also a repro case in a form of a failing E2E test: https://github.com/kubernetes/kubernetes/commit/246233597d4f9499a25914ed8fe17335cb56d9aa

• Failure [25.529 seconds]
[k8s.io] ResourceQuota
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/framework.go:656
  should create a ResourceQuota and return generated name. [It]
  /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/resource_quota.go:559

  Expected
      <string>:
  to equal
      <string>: test-quota-with-prefix-

  /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/resource_quota.go:558

Anything else we need to know:

I checked other resources, specifically Config Map & Pod and they both seem to persist and return the generateName attribute, so I’m assuming this behaviour is not by design.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (15 by maintainers)

Most upvoted comments

Quota is split between sig-node and sig-api-machinery and sig-scheduling. I don’t really care who fixes it, but it’s definitely inconsistent for it to be persisted differently.

On Mon, Oct 2, 2017 at 5:09 PM, Mehdy Bohlool notifications@github.com wrote:

OK. I can re-open the issue. But this is not api-machinery for sure. We do not control the content of the API. Please find the right sig to take care of this.

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/kubernetes/kubernetes/issues/44539#issuecomment-333665796, or mute the thread https://github.com/notifications/unsubscribe-auth/ABG_p0psWlXoFir220JBPEB4MkqalPJGks5soVD5gaJpZM4M-l7v .