Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

f8 not setting imagestreams resourceVersion properly. #1696

Closed
weinzierl-florian opened this issue Aug 28, 2019 · 19 comments · Fixed by #1705 or #1735
Closed

f8 not setting imagestreams resourceVersion properly. #1696

weinzierl-florian opened this issue Aug 28, 2019 · 19 comments · Fixed by #1705 or #1735
Labels
prio/p2 Some priority size/s Small

Comments

@weinzierl-florian
Copy link

f8 not setting imagestreams resourceVersion properly.

Description

I wrote the following yml config for an imageStream:

apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
  labels:
    environment: develop
  name: develop
spec:
  dockerImageRepository: <privateRepo>:5000/cbom/develop
  lookupPolicy:
    local: true
  tags:
  - from:
      kind: DockerImage
      name: <privateRepo>:5000/cbom/develop:latest
    importPolicy:
      scheduled: true

if I run fabric8: resource-Goal it succeeds properly
But running fabric8:apply-Goal afterwards fails with:

F8: Failed to create ImageStream from openshift.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PUT at: <OpenShift Url>/apis/image.openshift.io/v1/namespaces/testpro/imagestreams/develop. Message: imagestreams.image.openshift.io "develop" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.resourceVersion, message=Invalid value: 0x0: must be specified for an update, reason=FieldValueInvalid, additionalProperties={})], group=image.openshift.io, kind=imagestreams, name=develop, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=imagestreams.image.openshift.io "develop" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PUT at: <OpenShift Url>/apis/image.openshift.io/v1/namespaces/testpro/imagestreams/develop. Message: imagestreams.image.openshift.io "develop" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.resourceVersion, message=Invalid value: 0x0: must be specified for an update, reason=FieldValueInvalid, additionalProperties={})], group=image.openshift.io, kind=imagestreams, name=develop, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=imagestreams.image.openshift.io "develop" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).

I tried Setting resourceVersion: 1 in the metadata section but got:

F8: Failed to create ImageStream from openshift.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: <OpenShift Url>/apis/image.openshift.io/v1/namespaces/testpro/imagestreams. Message: resourceVersion should not be set on objects to be created. Received status: Status(apiVersion=v1, code=500, details=null, kind=Status, message=resourceVersion should not be set on objects to be created, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=null, status=Failure, additionalProperties={}).: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: <OpenShift Url>/apis/image.openshift.io/v1/namespaces/testpro/imagestreams. Message: resourceVersion should not be set on objects to be created. Received status: Status(apiVersion=v1, code=500, details=null, kind=Status, message=resourceVersion should not be set on objects to be created, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=null, status=Failure, additionalProperties={}).

BUT If I went to the Web UI choose Import YAML/JSON under the Add to Project-Button and copied the exact same Config above (without the resourceVersion setting) it worked without any problems

Info

  • f-m-p version : 4.2.0
  • Maven version (mvn -v) :
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Development\apps\Maven
Java version: 1.8.0_102-1-redhat, vendor: Oracle Corporation
Java home: C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.102-1\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
  • Kubernetes / OpenShift setup and version :
    Red Hat OpenShift
    Version
OpenShift Master:
v3.11.0+3b2d3b6-227
Kubernetes Master:
v1.11.0+d4cacc0
OpenShift Web Console:
v3.11.0+ea42280
  • If it's a bug, how to reproduce :
    Create a configfile for an ImageStream and try to execute fabric8:resource and afterwards fabric8:apply
@weinzierl-florian
Copy link
Author

Maybe this is related:
openshift/origin#19905

@erikgb
Copy link
Contributor

erikgb commented Sep 11, 2019

I am experiencing the same behavior, and this represents a blocking issue for me. @weinzierl-florian, did you manage to find a workaround?

@rohanKanojia
Copy link
Member

oh, is it happening for ImageStreams only or for other resources as well? Edit gives 422 if metadata.resourceVersion not specified?

@rohanKanojia rohanKanojia added prio/p2 Some priority size/s Small labels Sep 11, 2019
@erikgb
Copy link
Contributor

erikgb commented Sep 11, 2019

@rohanKanojia It seems to be happening just for ImageStreams, but I haven't tested all types of resources. I can add that the problem is also present in version 4.1.0 of fabric8-maven-plugin, so this is not a "new" issue. It seems to work with version 4.0.0, so I can downgrade for now.

@rohanKanojia
Copy link
Member

hmm, when I append resourceVersion while doing PUT on ImageStream resource, it seems to be applied correctly. Let me create a PR for this.

@weinzierl-florian
Copy link
Author

weinzierl-florian commented Sep 14, 2019

@erikgb:
I don't really have any workaround since I found it by using it as part of the resource-goal out of a Jenkins pipeline I just removed the Image-Stream config file and did the operation through the corresponding OC-Program command.

Maybe downgrading is the only option until this is finally solved.

@rohanKanojia:
It is only happening for Image-Streams as far as I can tell for now

@rohanKanojia
Copy link
Member

@weinzierl-florian : I've created a PR to explicitly add resourceVersion in metadata. I don't see any harm in doing this.

@nikolaaleks
Copy link

Hello @rohanKanojia,

Unfortunately I am still not able to successfully apply the generated imagestreams.yamls with “mvn fabric8:apply”. I used the latest 4.3.0 version of the plugin. Could you please double check if that is working. Thank you very much in advance!

The error says that it can not create ImageStream and has failure when executing PUT.

Regards,
Nikola

@rohanKanojia
Copy link
Member

what response code are you getting? 422?

@rohanKanojia
Copy link
Member

Could you please share logs with -X option?

@rohanKanojia
Copy link
Member

@nikolaaleks : You're right. I'm also able to reproduce this 😞

@rohanKanojia rohanKanojia reopened this Oct 15, 2019
@nikolaaleks
Copy link

Hi @rohanKanojia,

After I have generated the resources with “mvn fabric8:resource” when I try to call “mvn fabric8:apply” I get the error code 422 and image stream is generated in OpenShift. If I call fabric8:apply second time the error has code 409. If i call it third time there is no error at all, which is strange. It depends and how much imagestreams.yamls I have generated. I will look what the output is when I call it in Debug mode and let you know.

Regards,
Nikola

@rohanKanojia
Copy link
Member

hmm, weird. Let me fix this.

@rohanKanojia
Copy link
Member

@nikolaaleks : I've created a PR which seems to be working for me. Would appreciate if you could test it and provide feedback. It would only take 5-8 minutes.

@nikolaaleks
Copy link

Hi @rohanKanojia,

I have successfully tested the fix that you have proposed. I was able to generate the imagestreams in OpenShift by using "mvn fabric8:apply". When could I expect to get the newer version of the plugin? Thank you in advance.

Regards,
Nikola

@rohanKanojia
Copy link
Member

@nikolaaleks : Thanks a lot for trying it out 👍 . I'm planning to cut 4.3.1 this week.

@rohanKanojia
Copy link
Member

@nikolaaleks : FMP 4.3.1 has been released.

@nikolaaleks
Copy link

nikolaaleks commented Oct 22, 2019

Hi @rohanKanojia,

Can you tell me when the FMP 4.3.1 will be available also in maven central repository - https://mvnrepository.com/artifact/io.fabric8/fabric8-maven-plugin ? Is that something that you control? Thank you in advance!

Regards,
Nikola

@erikgb
Copy link
Contributor

erikgb commented Oct 22, 2019

@nikolaaleks : It is already there: https://search.maven.org/artifact/io.fabric8/fabric8-maven-plugin/4.3.1/maven-plugin

You should start using the official Maven search, and not the "commercial" one. 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
prio/p2 Some priority size/s Small
Projects
None yet
4 participants