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

kubectl third party resource race #24392

Closed
polvi opened this issue Apr 18, 2016 · 2 comments
Closed

kubectl third party resource race #24392

polvi opened this issue Apr 18, 2016 · 2 comments
Assignees
Labels
area/kubectl kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@polvi
Copy link
Contributor

polvi commented Apr 18, 2016

When registering more than one ThirdPartyResource, there appears to be a race in kubectl for the ability to read the APIs. Note that all these commands are executed sequentially, and an empty response on the get is due to no objects being registered (this is an expected behavior). This is using kubectl at e81663c, which is after #18835 landed.

$ cat tprs.yml
apiVersion: extensions/v1beta1
description: A foo
kind: ThirdPartyResource
metadata:
  name: foo.foo.example.com
versions:
- name: v1

---
apiVersion: extensions/v1beta1
description: A bar
kind: ThirdPartyResource
metadata:
  name: bar.bar.example.com
versions:
- name: v1
$ kubectl create -f tprs.yml 
thirdpartyresource "foo.foo.example.com" created
thirdpartyresource "bar.bar.example.com" created
$ kubectl get foos
error: unknown api group/version: foo.example.com/v1, Kind=Foo
$ kubectl get bars
error: unknown api group/version: bar.example.com/v1, Kind=Bar
$ kubectl get bars
error: unknown api group/version: bar.example.com/v1, Kind=Bar
$ kubectl get bars
$ kubectl get foos
$ kubectl get foos
error: unknown api group/version: foo.example.com/v1, Kind=Foo
$ kubectl get foos
$ kubectl get foos
$

I believe the fix is here, but I'm not in a position to properly test (although I did test a kubectl build by hand and it seemed to work).

diff --git a/pkg/apimachinery/registered/registered.go b/pkg/apimachinery/registered/registered.go
index c1e1511..110ef1b 100644
--- a/pkg/apimachinery/registered/registered.go
+++ b/pkg/apimachinery/registered/registered.go
@@ -202,7 +202,7 @@ func AddThirdPartyAPIGroupVersions(gvs ...unversioned.GroupVersion) []unversione
        for ix := range filteredGVs {
                next[ix] = filteredGVs[ix]
        }
-       thirdPartyGroupVersions = next
+       thirdPartyGroupVersions = append(thirdPartyGroupVersions, next...)

        return skippedGVs
 }
@bprashanth
Copy link
Contributor

@kubernetes/kubectl

@bgrant0607 bgrant0607 added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Apr 21, 2016
@bgrant0607
Copy link
Member

cc @caesarxuchao

@bgrant0607 bgrant0607 added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. kind/bug Categorizes issue or PR as related to a bug. and removed team/ux labels Apr 21, 2016
@brendandburns brendandburns self-assigned this Jun 23, 2016
k8s-github-robot pushed a commit that referenced this issue Jul 22, 2016
Automatic merge from submit-queue

Fix a problem with multiple APIs clobbering each other in registration.

Fixes #24392

@kubernetes/sig-api-machinery 

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
openshift-publish-robot pushed a commit to openshift/kubernetes that referenced this issue Jan 16, 2020
[release-4.3] Bug 1790481: Fix delegated auth CM perms

Origin-commit: 9eb2d2d44d0c432b6e70963f78efdbe0788d09a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

5 participants