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

Unable to create Template on OCP4 #1805

Closed
mchoma opened this issue Oct 9, 2019 · 8 comments · Fixed by #1956
Closed

Unable to create Template on OCP4 #1805

mchoma opened this issue Oct 9, 2019 · 8 comments · Fixed by #1956
Labels
bug platform/openshift Specific to OpenShift
Projects

Comments

@mchoma
Copy link

mchoma commented Oct 9, 2019

I am getting

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://api.domain:6443/oapi/v1/namespaces/namespace/templates. Received status: Status(apiVersion=v1, code=404, details=null, kind=Status, message=null, metadata=null, reason=null, status=null, additionalProperties={}).

With 4.1.1 it was OK.

Template is version v1

{
    "kind": "Template",
    "apiVersion": "v1",
    "metadata": {
        "annotations": {

Creating with

	public Template createTemplate(Template template) {
		return templates().create(template);
	}

I understand this is somehow related to [1] and [2]. As this worked with 4.1.1 is this regression?

But I am not sure what is now correct solution for this. Correct Update templates objects to template.openshift.io/v1? Templates are not ours, so there may be some resistance to do so argumenting change is initiated by client change.

What could be workaround for this? Can we set template.setApiVersion("template.openshift.io/v1"); in our code to make it work on OCP4?

[1] #1684
[2] #1631

@mchoma
Copy link
Author

mchoma commented Oct 9, 2019

@gastaldi ^^^ could you have a look please?

@gastaldi
Copy link
Contributor

gastaldi commented Oct 9, 2019

Yes, this is a fix that was introduced in 4.4.2 AFAIK. Because the oapi endpoint no longer exists in OpenShift 4.x, it's necessary to change the apiVersion in the template to template.openshift.io/v1) (explicitly call template.setApiVersion("template.openshift.io/v1") may also work)

There are other resources that may need this change, see https://issues.jboss.org/browse/RHOAR-124 for more details

@mchoma
Copy link
Author

mchoma commented Oct 9, 2019

@gastaldi how do you explain we run Templates in version v1 with client version 4.1.1 with no problem on OCP4?

@gastaldi
Copy link
Contributor

gastaldi commented Oct 9, 2019

Initial support for OpenShift 4 was introduced in 4.4.0, but there are cases where it would still hit the oapi endpoint.

Can you confirm 4.1.1 hits /apis/template.openshift.io/v1/namespaces/{namespace}?

@gastaldi
Copy link
Contributor

gastaldi commented Oct 9, 2019

Also worth mentioning that changing the template does not impact OpenShift 3.x

@mchoma
Copy link
Author

mchoma commented Oct 9, 2019

@gastaldi I can confirm 4.1.1 hits https://api.<domain>:6443/apis/template.openshift.io/v1/namespaces/<namespace>/templates

@gastaldi
Copy link
Contributor

gastaldi commented Oct 9, 2019

Ok, then this seems to be a regression

@mchoma
Copy link
Author

mchoma commented Jul 28, 2020

@rohanKanojia We are still using workaround template.setApiVersion("template.openshift.io/v1"). Given this issue is fixed, should it work now without that workaround now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform/openshift Specific to OpenShift
Projects
No open projects
Project FKC
  
FKC Backlog
Development

Successfully merging a pull request may close this issue.

3 participants