origin
origin copied to clipboard
Discovery info for processedtemplates & templates both have kind: Template
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"],
-
Given
kind: Templateinput, how doesocknow which of the endpoints to hit? -
Could anything be added to discovery to make this unambiguous?
-
What is the difference between
/templatesand/processedtemplatesanyway? Do clients need both or can I just hardcode preference to/templates? -
The docs are non-helpful — don't explain the difference — and weird:
- https://docs.openshift.com/container-platform/3.11/rest_api/apis-template.openshift.io/v1.Template.html documents
"kind": "Template"for both endpoints. - https://docs.openshift.com/container-platform/3.11/rest_api/oapi/v1.Template.html documents
"kind": "ProcessedTemplate"for/templates. :bug: Is kindProcessedTemplatea real thing? - https://docs.openshift.com/container-platform/3.11/rest_api/oapi/v1.ProcessedTemplate.html documents
"kind": "ProcessedTemplate"for/processedtemplates.
The docs are organized by
kind, could it be they're buggy as result of this collision? - https://docs.openshift.com/container-platform/3.11/rest_api/apis-template.openshift.io/v1.Template.html documents
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
curl $API/apis/template.openshift.io/v1/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.
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
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
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-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.
/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 processedtemplatesbehaves confusingly by performingGET .../templates. :bug: It works (e.g. tryoc get processedtemplates -n openshift). (This demonstrates thatocis also partially confused by this collision?) - [ ]
oc explain processedtemplatecontradicts this by saying:the server doesn't have a resource type "processedtemplate" - [ ]
oc explain templatefails, saying :bug: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".
@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 performsPOST https://192.168.99.103:8443/apis/template.openshift.io/v1/namespaces/myproject/processedtemplateswithRequest Body: {"kind":"Template","apiVersion":"template.openshift.io/v1",,"metadata":{"name":"route","creationTimestamp":null},...and gets backResponse 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 discoveryverbs": ["create"]).
- [ ]
oc get processedtemplatesbehaves confusingly by performingGET .../templates. :bug: It works (e.g. tryoc get processedtemplates -n openshift). (This demonstrates thatocis also partially confused by this collision?)- [ ]
oc explain processedtemplatecontradicts this by saying:the server doesn't have a resource type "processedtemplate"- [ ]
oc explain templatefails, saying :bug:error: Couldn't find resource for "template.openshift.io/v1, Kind=Template"AFAICT kind "ProcessedTemplate" is not a thing.
oc processsend "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.
Such collisions have caused a bunch of ResourceNotUniqueError errors in python lib (which is also a dynamic client using discovery info):
https://github.com/openshift/openshift-restclient-python/issues/284
and ansible k8s aka openshift_raw module that uses that lib:
https://github.com/ansible/ansible/issues/55221
https://github.com/ansible/ansible/issues/55388
/oapi paths are gone since https://github.com/openshift/origin/pull/21782 so that part can be ignored.
Most of the issue still stands.
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-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.
/reopen /remove-lifecycle rotten /lifecycle frozen
@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.
Hello! Any update on this? Still hitting this issue.