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

Discovery info for processedtemplates & templates both have kind: Template #21668

Open
cben opened this issue Dec 16, 2018 · 13 comments
Open

Discovery info for processedtemplates & templates both have kind: Template #21668

cben opened this issue Dec 16, 2018 · 13 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@cben
Copy link

cben commented Dec 16, 2018

This might not be a bug, but creates complications for dynamic clients parsing discovery info:

Both oapi/v1 and apis/template.openshift.io/v1 have 2 different paths with same kind:

      "name": "templates",
      "namespaced": true,
      "kind": "Template",
      "verbs": ["create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"],
...
      "name": "processedtemplates",
      "namespaced": true,
      "kind": "Template",
      "verbs": ["create"],
  1. Given kind: Template input, how does oc know which of the endpoints to hit?

  2. Could anything be added to discovery to make this unambiguous?

  3. What is the difference between /templates and /processedtemplates anyway?
    Do clients need both or can I just hardcode preference to /templates?

  4. The docs are non-helpful — don't explain the difference — and weird:

    The docs are organized by kind, could it be they're buggy as result of this collision?

Version
oc v3.11.0+8de5c34
kubernetes v1.10.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://192.168.99.103:8443
kubernetes v1.11.0+d4cacc0
Steps To Reproduce
  1. curl $API/apis/template.openshift.io/v1/
  2. curl $API/oapi/v1/
Current Result

Duplicate entries with different name but same kind.

Expected Result

Ideally, exactly one name per kind (ignoring subresources like routes/status).
If kind ProcessedTemplate really exists, can that be reported for "name": "processedtemplates"?
If impossible, some hint in discovery info helping decide between the two?

Additional Information

FWIW, there was a similar collision up to openshift 3.6 between DeploymentConfig /generatedeploymentconfigs and DeploymentConfig /deploymentconfigs. generatedeploymentconfigs is gone in 3.7+ discovery info.

cben added a commit to cben/kubeclient that referenced this issue Dec 17, 2018
Openshift discovery lists both `templates` and `processedtemplates`
for same kind "Template": openshift/origin#21668

`templates` is a regular stored api object.

`processedtemplates` endpoint isn't, its POST is a special
input (template + params) -> output function.
That functionality is already covered in kubeclient by `process_template`
method.  It doesn't need regular create_, get_, watch_ etc methods.

This is already so because in all openshift versions, `templates` comes
after `processedtemplates` and replaces it in `@entities["Template"]`.
cben added a commit to cben/kubeclient that referenced this issue Dec 17, 2018
Openshift discovery lists both `templates` and `processedtemplates`
for same kind "Template": openshift/origin#21668

`templates` is a regular stored api object.

`processedtemplates` endpoint isn't a stored object,
its POST is a special input (template + params) -> output function.
That functionality is already covered in kubeclient by `process_template`
method.  It doesn't need regular create_, get_, watch_ etc methods.

This is already so because in all openshift versions, `templates` comes
after `processedtemplates` and replaces it in `@entities["template"]`.
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2019
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-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 Apr 16, 2019
@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci-robot
Copy link

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

@cben
Copy link
Author

cben commented May 19, 2019

/reopen

  • Documents are still confusing and at least one is wrong. Edited OP with a bit more details.

To partially answer myself, /processedtemplates endpoint is a pseudo-collection for server-side
oc process. With oc v1.13 I see it performs POST https://192.168.99.103:8443/apis/template.openshift.io/v1/namespaces/myproject/processedtemplates with Request Body: {"kind":"Template","apiVersion":"template.openshift.io/v1",,"metadata":{"name":"route","creationTimestamp":null},...
and gets back Response Body: {"kind":"Template","apiVersion":"template.openshift.io/v1","metadata":{"name":"route","selfLink":"/apis/template.openshift.io/v1/namespaces/myproject/processedtemplates/route",....
"Pseudo-collection" because you can only POST, and the result is ephemeral, server doesn't add it to any storage. Attempting to GET returns MethodNotAllowed (consistent with discovery verbs": ["create"]).

  • oc get processedtemplates behaves confusingly by performing GET .../templates. 🐛
    It works (e.g. try oc get processedtemplates -n openshift).
    (This demonstrates that oc is also partially confused by this collision?)
  • oc explain processedtemplate contradicts this by saying:
    the server doesn't have a resource type "processedtemplate"
  • oc explain template fails, saying 🐛
    error: Couldn't find resource for "template.openshift.io/v1, Kind=Template"

AFAICT kind "ProcessedTemplate" is not a thing. oc process send "Template" it and server responds with "Template".

@openshift-ci-robot
Copy link

@cben: Reopened this issue.

In response to this:

/reopen

  • Documents are still confusing and at least one is wrong. Edited OP with a bit more details.

To partially answer myself, /processedtemplates endpoint is a pseudo-collection for server-side
oc process. With oc v1.13 I see it performs POST https://192.168.99.103:8443/apis/template.openshift.io/v1/namespaces/myproject/processedtemplates with Request Body: {"kind":"Template","apiVersion":"template.openshift.io/v1",,"metadata":{"name":"route","creationTimestamp":null},...
and gets back Response Body: {"kind":"Template","apiVersion":"template.openshift.io/v1","metadata":{"name":"route","selfLink":"/apis/template.openshift.io/v1/namespaces/myproject/processedtemplates/route",....
"Pseudo-collection" because you can only POST, and the result is ephemeral, server doesn't add it to any storage. Attempting to GET returns MethodNotAllowed (consistent with discovery verbs": ["create"]).

  • oc get processedtemplates behaves confusingly by performing GET .../templates. 🐛
    It works (e.g. try oc get processedtemplates -n openshift).
    (This demonstrates that oc is also partially confused by this collision?)
  • oc explain processedtemplate contradicts this by saying:
    the server doesn't have a resource type "processedtemplate"
  • oc explain template fails, saying 🐛
    error: Couldn't find resource for "template.openshift.io/v1, Kind=Template"

AFAICT kind "ProcessedTemplate" is not a thing. oc process send "Template" it and server responds with "Template".

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.

@cben
Copy link
Author

cben commented May 19, 2019

Such collisions have caused a bunch of ResourceNotUniqueError errors in python lib (which is also a dynamic client using discovery info):
openshift/openshift-restclient-python#284
and ansible k8s aka openshift_raw module that uses that lib:
ansible/ansible#55221
ansible/ansible#55388

@cben
Copy link
Author

cben commented May 19, 2019

/oapi paths are gone since #21782 so that part can be ignored.
Most of the issue still stands.

@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci-robot
Copy link

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

@cben
Copy link
Author

cben commented Jun 19, 2019

/reopen
/remove-lifecycle rotten
/lifecycle frozen

@openshift-ci-robot
Copy link

@cben: Reopened this issue.

In response to this:

/reopen
/remove-lifecycle rotten
/lifecycle frozen

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.

@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jun 19, 2019
rayfordj pushed a commit to rayfordj/mig-ci that referenced this issue Sep 30, 2019
@CermakM
Copy link

CermakM commented Nov 13, 2019

Hello! Any update on this? Still hitting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants