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

application redeployment is getting failed for OpenShift v3.7.0 #1130

Closed
hrishin opened this issue Dec 8, 2017 · 34 comments
Closed

application redeployment is getting failed for OpenShift v3.7.0 #1130

hrishin opened this issue Dec 8, 2017 · 34 comments
Assignees
Labels
cat/bug Bug which needs fixing prio/p0 Highest priority
Milestone

Comments

@hrishin
Copy link
Member

hrishin commented Dec 8, 2017

Description

If f8-m-p redeploy the existing application on OpenShift v3.7 then Deployment is not happening correctly.
Its unable to pull the images and status appears ImgPullErr for a long time. After some time with 4-5 retries, it's able to pull the image and deployment happen.

Info

This might be an issue with F8-M-P or OpenShift.

  • f-m-p version : v3.5.34
  • Maven version (mvn -v) :

  • Kubernetes / OpenShift setup and version : OpenShift v3.7.0

  • If it's a bug, how to reproduce :

  • deploy the application using mvn install or mvn fabric8:deploy
  • again invoke mvn insall or mvn fabric8:deploy
@hrishin
Copy link
Member Author

hrishin commented Dec 11, 2017

Found this issue in regression test execution

@hrishin hrishin changed the title application redeployment is getting failed for OpenShift v3.7 application redeployment is getting failed for OpenShift v3.7.0 Dec 12, 2017
@hrishin hrishin added this to the Sprint 142 milestone Dec 12, 2017
@hrishin hrishin added prio/p0 Highest priority and removed WIP labels Dec 12, 2017
@hrishin hrishin modified the milestones: Sprint 142, Sprint 143 Jan 3, 2018
@rohanKanojia rohanKanojia self-assigned this Jan 16, 2018
@rohanKanojia
Copy link
Member

rohanKanojia commented Jan 18, 2018

Confirmed, I was able to reproduce the bug you reported. Here are some pod logs:
#1st Deployment

~/work/repos/fabric8-maven-plugin/samples/spring-boot : $ oc get pods -w
NAME                                       READY     STATUS    RESTARTS   AGE
fabric8-maven-sample-spring-boot-1-vlfb8   1/1       Running   0          2m
fabric8-maven-sample-spring-boot-s2i-1-build   0/1       Completed   0         6m
fabric8-maven-sample-spring-boot-s2i-2-build   0/1       Completed   0         3m

#2nd Deployment

fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Init:0/2   0         1s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Init:0/2   0         2s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Init:1/2   0         3s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       PodInitializing   0         4s
fabric8-maven-sample-spring-boot-s2i-3-build   1/1       Running   0         5s
fabric8-maven-sample-spring-boot-2-deploy   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-2-deploy   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-2-deploy   0/1       ContainerCreating   0         2s
fabric8-maven-sample-spring-boot-s2i-3-build   0/1       Completed   0         11s
fabric8-maven-sample-spring-boot-2-deploy   1/1       Running   0         3s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       ContainerCreating   0         1s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Running   0         3s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Init:0/2   0         2s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Init:0/2   0         3s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Init:1/2   0         5s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       PodInitializing   0         6s
fabric8-maven-sample-spring-boot-s2i-4-build   1/1       Running   0         7s
fabric8-maven-sample-spring-boot-2-57g6h   1/1       Running   0         21s
fabric8-maven-sample-spring-boot-1-vlfb8   1/1       Terminating   0         5m
fabric8-maven-sample-spring-boot-2-deploy   1/1       Terminating   0         26s
fabric8-maven-sample-spring-boot-1-vlfb8   0/1       Terminating   0         5m
fabric8-maven-sample-spring-boot-2-deploy   0/1       Terminating   0         26s
fabric8-maven-sample-spring-boot-s2i-4-build   0/1       Completed   0         13s
fabric8-maven-sample-spring-boot-3-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-3-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-3-deploy   0/1       ContainerCreating   0         1s
fabric8-maven-sample-spring-boot-3-deploy   1/1       Running   0         2s
fabric8-maven-sample-spring-boot-2-57g6h   1/1       Terminating   0         25s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Terminating   0         26s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       ContainerCreating   0         2s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Terminating   0         27s
fabric8-maven-sample-spring-boot-2-57g6h   0/1       Terminating   0         27s
fabric8-maven-sample-spring-boot-3-deploy   1/1       Terminating   0         6s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Running   0         4s
fabric8-maven-sample-spring-boot-3-deploy   0/1       Terminating   0         7s
fabric8-maven-sample-spring-boot-4-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-4-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-4-deploy   0/1       ContainerCreating   0         2s
fabric8-maven-sample-spring-boot-3-deploy   0/1       Terminating   0         9s
fabric8-maven-sample-spring-boot-3-deploy   0/1       Terminating   0         9s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Terminating   0         8s
fabric8-maven-sample-spring-boot-4-deploy   1/1       Running   0         4s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ContainerCreating   0         1s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Terminating   0         9s
fabric8-maven-sample-spring-boot-1-vlfb8   0/1       Terminating   0         6m
fabric8-maven-sample-spring-boot-1-vlfb8   0/1       Terminating   0         6m
fabric8-maven-sample-spring-boot-2-deploy   0/1       Terminating   0         38s
fabric8-maven-sample-spring-boot-2-deploy   0/1       Terminating   0         38s
fabric8-maven-sample-spring-boot-4-deploy   0/1       Completed   0         8s
fabric8-maven-sample-spring-boot-4-deploy   0/1       Terminating   0         8s
fabric8-maven-sample-spring-boot-4-deploy   0/1       Terminating   0         8s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         8s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Terminating   0         20s
fabric8-maven-sample-spring-boot-3-c5qnv   0/1       Terminating   0         20s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         22s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         42s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         55s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         1m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         1m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         2m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         2m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         3m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         3m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ErrImagePull   0         6m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       ImagePullBackOff   0         6m
fabric8-maven-sample-spring-boot-5-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-5-deploy   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-5-deploy   0/1       ContainerCreating   0         1s
fabric8-maven-sample-spring-boot-5-deploy   1/1       Running   0         3s
fabric8-maven-sample-spring-boot-5-rgwz4   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-5-rgwz4   0/1       Pending   0         2s
fabric8-maven-sample-spring-boot-5-rgwz4   0/1       ContainerCreating   0         2s
fabric8-maven-sample-spring-boot-5-rgwz4   0/1       Running   0         3s
fabric8-maven-sample-spring-boot-5-rgwz4   1/1       Running   0         22s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Terminating   0         8m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Terminating   0         8m
fabric8-maven-sample-spring-boot-5-deploy   0/1       Completed   0         26s
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Terminating   0         8m
fabric8-maven-sample-spring-boot-4-rb9r2   0/1       Terminating   0         8m
fabric8-maven-sample-spring-boot-5-deploy   0/1       Terminating   0         26s
fabric8-maven-sample-spring-boot-5-deploy   0/1       Terminating   0         26s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Pending   0         1s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       ContainerCreating   0         1s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Terminating   0         1s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Terminating   0         1s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Terminating   0         13s
fabric8-maven-sample-spring-boot-3-wbsv7   0/1       Terminating   0         13s

Surprisingly, application pod comes back into a steady state after some time. Need to check why this behaviour is happening.

@mojsha
Copy link

mojsha commented Jan 18, 2018

I am also running into this issue in a OpenShift 3.7 cluster.

Observations:

  1. Initial deploy works.

  2. Subsequent deploy with my sample application having a sidecar container and an init container does NOT work for the main application container due to inability to pull image. Sidecar container and init container are able to pull their images successfully.

  3. As observed by others, the image pulling does not fail immediately. It takes quite a while.

@lordofthejars
Copy link
Contributor

Is this something related to OpenShift 3.7.0 or fmp version? Wha tI mean is can I use the current version of fmp with OpenShift 3.6.0 without any problem or I'll face the same problem?

@piyush-garg
Copy link
Collaborator

Hi @lordofthejars

As far as I know, this problem is specific to using fmp with Openshift 3.7.0 . It will work fine with previous Openshift version. If you use the current version of fmp with Openshift 3.6.0, ideally it should work.

cc @rohanKanojia @hrishin

Thanks

@mojsha
Copy link

mojsha commented Jan 19, 2018

@lordofthejars This is a OpenShift 3.7 issue for me. It's actually a major blocker and preventing us from moving to OpenShift 3.7.

In OpenShift 3.6, it works fine.

@rohanKanojia
Copy link
Member

I tried doing this with older versions of Fabric8 maven plugin but faced a similar issue. I don't think this has something to do with Fabric8 maven plugin. On OpenShift 3.7, people are facing these kinds of issues, one of them can be found here.

@galderz
Copy link

galderz commented Jan 29, 2018

As @rohanKanojia said, I've been having this issue too. In fact, I think I already encountered during a live coding presentation back in November but forgot about it.

My planned workaround for this is to switch to binary deployments. E.g. do mvn package and have a Dockerfile in the root of the project. We used this method extensively up to November when I decided to try FMP (e.g. see this project).

@mojsha
Copy link

mojsha commented Jan 29, 2018

I have done some deep diving into this and I am fairly certain that it is triggered by F-M-P target "fabric8:apply". I am not saying it is the F-M-P itself, but perhaps one of its dependencies that interact with OpenShift.

I can see in the log that when I bump the image version (fabric8:resource and fabric8:build) on top of an existing DC that has been deployed and run a fabric8:apply, a lot of things happen but what I managed to extract from the server-side logs is the following:

I0129 13:18:04.108057 2982 rest.go:91] New deployment for "demo" caused by []apps.DeploymentCause{apps.DeploymentCause{Type:"Manual", ImageTrigger:(*apps.DeploymentCauseImageTrigger)(nil)}} I0129 13:18:04.117073 2982 wrap.go:42] POST /oapi/v1/namespaces/myproject/deploymentconfigs/demo/instantiate: (12.683965ms) 201 [[oc/v3.6.0+c4dd4cf (linux/amd64) openshift/c4dd4cf] 192.168.42.1:49442]

and when looking at rest.go:91 you can see that it will go through all the triggers to verify that it can indeed be triggered (https://github.com/openshift/origin/blob/12d2744c60e3f7a27d6b76a06d5b4d2a5f40e246/pkg/apps/registry/instantiate/rest.go#L91).

The instantiate log-entry above also seems to point at resource being a OC 3.6 - which is a version below 3.7. This looks like it's due to a dependency of F-M-P that doesn't use OC 3.7?

When I do the same thing via the web console - that is, do a fabric8:build to push up a new version of the image - and manually bump the version of the image via the UI dropdown and save, it does not trigger a re-deployment and I cannot find it in the logs.

@mojsha
Copy link

mojsha commented Feb 1, 2018

@hrishin @rohanKanojia
I've done some client-side interception of F-M-P calls to OpenShift and compared with the Web Console interaction.

What seems to be new in 3.7 is that if the container image reference is updated, it will lead to a redeployment being triggered. This is not due to the ImageTrigger - which I have disabled in my case - which acts based on ImageStream changes.

If the image trigger reference is updated, it works just like in 3.6 and only executes once there is a rollout. This is what happens when you modify the image reference via the Web Console - it only changes the trigger section's image reference.

On the other hand, F-M-P changes both the Image Trigger section as well as the Container Image reference which leads to an automatic deploy (which fails) in 3.7.

I think we need to change the DeploymentConfig generation in F-M-P such that it only updates the trigger section if there is one and thereby does not "auto-deploy". The deployment can then be triggered by oc rollout which will resolve the trigger Image reference.

I don't have a solution for cases where there is no trigger.

rohanKanojia added a commit to rohanKanojia/fabric8-maven-plugin that referenced this issue Feb 8, 2018
…enShift v3.7.0

+ Added a workaround to deal with ImageTriggers.
+ Added flag fabric8.openshift.trimImageInContainerSpec which would trim
  image in container spec
hrishin pushed a commit that referenced this issue Feb 12, 2018
Fixes #1130 Application redeployment is getting failed on OpenShift v3.7.0
@hrishin
Copy link
Member Author

hrishin commented Feb 12, 2018

hey @valdar it's not yet available. Will make it available soon, in a day or two max.

@piyush-garg
Copy link
Collaborator

Hey @valdar

FMP 3.5.35 has been released yesterday. It contains the workaround for redeployment on Openshift 3.7.x

You should hit for Openshift 3.7.x
mvn -Dfabric8.openshift.trimImageInContainerSpec=true fabric8:deploy

Thanks

valdar pushed a commit to valdar/fabric8-maven-plugin that referenced this issue Feb 16, 2018
…enShift v3.7.0

+ Added a workaround to deal with ImageTriggers.
+ Added flag fabric8.openshift.trimImageInContainerSpec which would trim
  image in container spec
+ Updated documentation related to flag.

Backporting changes to accomodate:
OSFUSE-718: [OSO][OCP 3.7] f-m-p redeployments failing to deploy
@Ladicek
Copy link
Contributor

Ladicek commented Mar 7, 2018

Sorry for the noise here, I know this is closed, but -- would using -Dfabric8.openshift.trimImageInContainerSpec=true be expected to work fine with OpenShift 3.6 as well?

@rohanKanojia
Copy link
Member

Yes, It would work on Openshift 3.6 also.

@Ladicek
Copy link
Contributor

Ladicek commented Mar 7, 2018

Thanks!

@piyush-garg
Copy link
Collaborator

piyush-garg commented Mar 19, 2018

Hey @hrishin @rohanKanojia @mojsha @Ladicek,

Just figured out that now redeployment is working on openshift 3.7 without the flag also. Can you please cross check. I think the updated the binary. Not sure.

Thanks

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2018

Is that with some newer OCP version that perhaps backported the bugfix?

@piyush-garg
Copy link
Collaborator

piyush-garg commented Mar 19, 2018

Here is the PR link openshift/origin#18524 which resolved this problem I think.

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2018

It seems to be backported to Origin 3.7.2 too, so not just OCP: https://github.com/openshift/origin/releases/tag/v3.7.2

At this point, I think the best course of action would be:

  • verify it's indeed fixed with Origin 3.7.2
  • find out which OCP version fixes that (for documentation purposes, see the point below)
  • document this as a known OpenShift issue, saying that it's fixed in Origin 3.7.2 / OCP 3.7.xyz (see the point above) and if updating to newest OpenShift isn't an option, then -Dfabric8.openshift.trimImageInContainerSpec is a possible workaround
  • remove -Dfabric8.openshift.trimImageInContainerSpec from our booster-parent

WDYT?

CC @cescoffier @metacosm

@mojsha
Copy link

mojsha commented Mar 19, 2018

@Ladicek Not sure why you want to remove this flag? The flag is doing something good, namely doesn't add unnecessary information. If you use a DC along with an ImageTrigger, you will get that field populated once the DC is executed. Populating that field in this scenario has no meaning, and as we saw in this case, 3.7 it caused problems.

This is also why the OpenShift developer in that thread (openshift/origin#18406 (comment)) says:

If you are using ImageChangeTrigger always set container's image to " ". Actually that applies in general - if there is a configChangeTrigger never set image to anything else than " ".

Please do not remove this flag - if someone does not need it, simply don't use it. But for the abovementioned use-case this makes sense.

@piyush-garg
Copy link
Collaborator

@Ladicek

Can you please help me with the link of the boosters you are talking about to remove the flags?

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2018

Sorry guys, when I said "remove the flag", I didn't mean "remove it from FMP", I meant "remove it from RHOAR quickstarts (aka boosters)". We enable it by default in there, which I think we no longer have to do (if the fix in OpenShift actually fixes the problem), and it actually causes us some issues (which I'm sure @cescoffier would be happy to tell you about :-) ).

@piyush-garg
Copy link
Collaborator

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2018

Yes.

Did I just open a can of worms I didn't really want to touch?

@piyush-garg
Copy link
Collaborator

No, i just want to confirm that this parent pom has something to do with https://github.com/snowdrop/spring-boot-crud-booster. Because we are using this booster for our regression tests and if by default the flag is added than my findings may be wrong.

@Ladicek
Copy link
Contributor

Ladicek commented Mar 19, 2018

@piyush-garg
Copy link
Collaborator

Hey @Ladicek

I just checked with openshift 3.7.0 it worked with that also. Have you tried it and any thoughts on this.

cc @mojsha

Thanks

jamesfalkner added a commit to jamesfalkner/rhoar-getting-started that referenced this issue May 31, 2018
jamesfalkner added a commit to jamesfalkner/rhoar-getting-started that referenced this issue May 31, 2018
@metacosm
Copy link
Contributor

metacosm commented Jul 2, 2018

I'm late on this, @Ladicek. Your plan looks like a winner in my book. :)

@Ladicek
Copy link
Contributor

Ladicek commented Jul 2, 2018

I no longer recall and don't even want to :-D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cat/bug Bug which needs fixing prio/p0 Highest priority
Projects
None yet
Development

No branches or pull requests

10 participants