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:
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' ~~~
> 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
(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?
Tomas can you answer Sam's question from comment 8 please?
@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
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
> 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?
That's exactly what it was. I can reproduce now. Thanks!
Both version are updated. Verified on v3.11.154
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