Bug 1708630 - Deployment rollback triggered from web console does not rollback image used
Summary: Deployment rollback triggered from web console does not rollback image used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 3.9.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: 3.11.z
Assignee: Samuel Padgett
QA Contact: Yadan Pei
URL:
Whiteboard: workloads
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-10 12:21 UTC by Arnab Ghosh
Modified: 2019-11-18 14:52 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-18 14:52:08 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift origin-web-console pull 3151 0 'None' closed Bug 1708630: Specify revision in DeploymentConfigRollback request 2020-10-27 08:10:15 UTC
Red Hat Product Errata RHBA-2019:3817 0 None None None 2019-11-18 14:52:18 UTC

Description Arnab Ghosh 2019-05-10 12:21:55 UTC
Description of problem:

After triggering roll back to a older version from web console I could see that the new version of deployment using same image as previous version of deployment.

Bellow is a sample of the issueu that we have:

        - We have a last "dc/sample" in version 5 that use a image version 10 but I need to do a rollback to "dc/sample" version 2 that use a image version 3.
  	- When we do this using the rollback button in Openshift Web Console, a new version is created("dc/sample" version 6) but the image version 10 is maintained.
	- When we do the same rollback using the "oc rollout undo dc/sample --to-revision=2" the "dc/sample" version 7 is created with the image version 3.
Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Try to roll back from web console
2. Try the same from CLI
3.

Actual results:
- Used image is not being rolled back

Expected results:
- Used image should be rolled back too

Additional info:

Comment 1 Arnab Ghosh 2019-05-10 12:23:13 UTC
I have tried to capture debug log from both CLI and console and found there are differences in request data when rollout triggered from CLI and console.

While triggering rollout from console the REST API call and Request data looks like below.

~~~
Request URL: https://openshift.arnabghosh311.redhat.com/apis/apps.openshift.io/v1/namespaces/arghosh/deploymentconfigs/ruby-ex/rollback
Request Method: POST
Request Payload:

apiVersion: "apps.openshift.io/v1"
kind: "DeploymentConfigRollback"
name: "ruby-ex"
spec: {from: {name: "ruby-ex-1"}, includeTemplate: true, includeReplicationMeta: true, includeStrategy: true,…}
from: {name: "ruby-ex-1"}
includeReplicationMeta: true
includeStrategy: true
includeTemplate: true
includeTriggers: true
~~~

While triggering rollout from CLI the REST API call and Request data looks like below.

~~~
Request Body: {"kind":"DeploymentConfigRollback","apiVersion":"apps.openshift.io/v1","name":"ruby-ex","spec":{"from":{},"revision":1,"includeTriggers":false,"includeTemplate":true,"includeReplicationMeta":false,"includeStrategy":false}}

I0509 03:25:27.552951   88315 round_trippers.go:386] curl -k -v -XPOST  -H "Accept: application/json, */*" -H "Content-Type: application/json" -H "User-Agent: oc/v1.11.0+d4cacc0 (linux/amd64) kubernetes/d4cacc0" 'https://openshift.internal.arnabghosh311.redhat.com:443/apis/apps.openshift.io/v1/namespaces/arghosh/deploymentconfigs/ruby-ex/rollback'
~~~

Comment 6 Tomáš Nožička 2019-08-29 12:05:14 UTC
> Request Body: {"kind":"DeploymentConfigRollback","apiVersion":"apps.openshift.io/v1","name":"ruby-ex","spec":{"from":{},"revision":1,"includeTriggers":false,"includeTemplate":true,"includeReplicationMeta":false,"includeStrategy":false}}

the request body should contain the name of the RC, not be empty.

sending to console team to investigate

Comment 8 Samuel Padgett 2019-08-29 12:25:20 UTC
(In reply to Tomáš Nožička from comment #6)
> > Request Body: {"kind":"DeploymentConfigRollback","apiVersion":"apps.openshift.io/v1","name":"ruby-ex","spec":{"from":{},"revision":1,"includeTriggers":false,"includeTemplate":true,"includeReplicationMeta":false,"includeStrategy":false}}
> 
> the request body should contain the name of the RC, not be empty.
> 
> sending to console team to investigate

I'm a little confused... It looks like you're quoting the CLI request, not the console request. Console does include the RC name as far as I can tell. Can you help us understand what the request should be?

Comment 12 Ben Parees 2019-10-08 14:47:31 UTC
Tomas can you answer Sam's question from comment 8 please?

Comment 14 Tomáš Nožička 2019-10-09 11:48:31 UTC
@Arnab

> spec: {from: {name: "ruby-ex-1"}, includeTemplate: true, includeReplicationMeta: true, includeStrategy: true,…}

It is hard to reason about the flow if you replace fields with ... (e.g. missing revision) - I am sure BZ would be able to handle few additional bytes

> While triggering rollout from CLI the REST API call and Request data looks like below.

It would be helpful if you've noted the exact command you run

> We have a last "dc/sample" in version 5 that use a image version 10 but I need to do a rollback to "dc/sample" version 2 that use a image version 3.

I am not sure I get that correctly - you want to rollback to version 2 yet the logs rollback to revision 1

Sam says he wasn't able to reproduce it in 3.9. Can you provide more concrete steps together with `oc get dc,rc,po,is -o yaml` and logs for CLI/Web UI requests?


@Sam
> I'm a little confused... It looks like you're quoting the CLI request, not the console request. Console does include the RC name as far as I can tell. Can you help us understand what the request should be?

You should be :) I mixed it up last time, sorry about that Sam.

Actually looking at the rollback code, I don't actually see the "spec.from" field used w.r.t. that. The revision field is what selects to which RC to rollback.

https://github.com/openshift/origin/blob/56ed4ecfe9f296e2f31ff90171a79037091e8846/pkg/apps/registry/rollback/rest.go#L79-L94

and includeTemplate should be true

https://github.com/openshift/origin/blob/56ed4ecfe9f296e2f31ff90171a79037091e8846/pkg/apps/registry/rollback/rollback_generator.go#L39-L44

which it seems like you already set, although I am not sure why there are the same fields in the dump above at top level too and not only in spec.

> I have a change locally that aligns console with the request that the CLI sends, but without a reproducer, I can't confidently say it fixes the bug.

For reference here is what CLI does in 3.9

https://github.com/openshift/origin/blob/34c3b212bb702742b0fd3cadb5d6fe428ce09872/pkg/oc/cli/cmd/rollback.go#L202-L302

Sam do you see a difference in what console is doing? I can't see it with only partial dumps provided in https://bugzilla.redhat.com/show_bug.cgi?id=1708630#c1

Comment 15 Samuel Padgett 2019-10-09 13:08:52 UTC
Hey, Tomas. The requests are pretty close, except console specifies the RC name in the `DeploymentConfigRollback` like `from: { name: my-rc-1 }` and doesn't specify the revision. I can change the console to use revision if that's correct. Both worked when I tried.

Here's the console code. (Note that var `deployment` in that code is a replication controller object.)

https://github.com/openshift/origin-web-console/blob/enterprise-3.9/app/scripts/services/deployments.js#L107-L123

Comment 16 Tomáš Nožička 2019-10-10 13:37:05 UTC
> and doesn't specify the revision.

I think this is the issue.

If you don't specify the revision it defaults to dc.Status.LatestVersion - 1

https://github.com/openshift/origin/blob/release-3.11/pkg/apps/apiserver/registry/rollback/rest.go#L80

> Both worked when I tried.

Any chance you tested just one revision back so it only looked like it works?

Comment 17 Samuel Padgett 2019-10-10 16:05:07 UTC
That's exactly what it was. I can reproduce now. Thanks!

Comment 19 XiaochuanWang 2019-11-07 09:59:10 UTC
Both version are updated. 
Verified on v3.11.154

Comment 21 errata-xmlrpc 2019-11-18 14:52:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3817


Note You need to log in before you can comment on or make changes to this bug.