Bug 1943543 - DeploymentConfig Rollback doesn't reset params correctly
Summary: DeploymentConfig Rollback doesn't reset params correctly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.8
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ---
: 4.8.0
Assignee: Jeff Phillips
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-26 11:55 UTC by Yadan Pei
Modified: 2021-07-27 22:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 22:56:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 8482 0 None open Bug 1943543: Fix to include template and selected options for RC rollbacks 2021-03-26 13:21:37 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:56:36 UTC

Description Yadan Pei 2021-03-26 11:55:01 UTC
Description of problem:
When choosing 'Rollback' action for RC, a Rollback modal is opened with some other options, if keep these options unchecked and rollback directly, it doesn't rollback rc correctly

Version-Release number of selected component (if applicable):
4.8.0-0.ci-2021-03-26-044604

How reproducible:
Always

Steps to Reproduce:
1. Create DC from example YAML(change replicas to 1) from console
2. Wait example-1 is ready, make sure no container environment for container
# ./oc48 get rc example-1 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}
3. Add env key and value, this will trigger a new deployment, make sure container env is set correctly
# ./oc48 get rc
NAME        DESIRED   CURRENT   READY   AGE
example-1   0         0         0       3m18s
example-2   1         1         1       16s
# ./oc48 get rc example-2 -o json | jq '.spec.template.spec.containers[0]'
{
  "env": [
    {
      "name": "key1",
      "value": "value1"
    }
  ],
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}
4. On Workloads -> ReplicationControllers page, select 'example-1' and choose 'Rollback' in kebab action list, don't choose any additional options and click 'Rollback' to confirm the rollback action
5. A new rc example-3 is created, check its details
# ./oc48 get rc example-3 -o json | jq '.spec.template.spec.containers[0]'
{
  "env": [
    {
      "name": "key1",
      "value": "value1"
    }
  ],
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}
# ./oc48 get pod example-3-7rh92 -o yaml | grep -i env -A3
            f:env:
              .: {}
              k:{"name":"key1"}:
                .: {}
--
  - env:
    - name: key1
      value: value1
    image: openshift/hello-openshift

Actual results:
5. We choose to rollback to 'example-1' but rc/example-3 still carried the environment setting only for example-2

Expected results:
5. since example-3 is rollback to example-1, example-1 doesn't have container environment set yet, so no environment should be set for rc/example-3

Additional info:
CLI doesn't seem reproduce the issue, here are the steps

[root@preserved-qe-ui-rhel-1 ~]# ./oc48 get rc example-1 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

[root@preserved-qe-ui-rhel-1 ~]# ./oc48 get rc example-2 -o json | jq '.spec.template.spec.containers[0]'
{
  "env": [
    {
      "name": "keytest1",
      "value": "keytest2"
    }
  ],
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}
[root@preserved-qe-ui-rhel-1 ~]# ./oc48 rollback example-1
deploymentconfig.apps.openshift.io/example deployment #3 rolled back to example-1
[root@preserved-qe-ui-rhel-1 ~]# ./oc48 get rc example-3 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}
[root@preserved-qe-ui-rhel-1 ~]# ./oc48 rollback example-2
deploymentconfig.apps.openshift.io/example deployment #4 rolled back to example-2
[root@preserved-qe-ui-rhel-1 ~]# ./oc48 get rc example-4 -o json | jq '.spec.template.spec.containers[0]'
{
  "env": [
    {
      "name": "keytest1",
      "value": "keytest2"
    }
  ],
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

[root@preserved-qe-ui-rhel-1 ~]# ./oc48 rollback example-1
deploymentconfig.apps.openshift.io/example deployment #5 rolled back to example-1
[root@preserved-qe-ui-rhel-1 ~]# ./oc48 get rc example-5 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "openshift/hello-openshift",
  "imagePullPolicy": "Always",
  "name": "hello-openshift",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

Comment 1 Yadan Pei 2021-03-26 11:56:34 UTC
I assume if we didn't choose any additional options in Rollback modal, default rollback behavior should be applied

Comment 3 Yadan Pei 2021-03-26 14:58:14 UTC
1. Create example DC from console
$ oc get rc -n yapeiconsole
NAME        DESIRED   CURRENT   READY   AGE
example-1   3         3         3       30s

$ oc get rc example-1 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
  "imagePullPolicy": "Always",
  "name": "httpd",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

=> add testkey1 & testvalue1 environment & scale down to 1,, this will trigger a new deployment
$ oc get rc
NAME        DESIRED   CURRENT   READY   AGE
example-1   0         0         0       2m36s
example-2   3         3         3       28s
$ oc get rc example-2 -o json | jq '.spec.template.spec.containers[0]'
{
  "env": [
    {
      "name": "testkey1",
      "value": "testkey2"
    }
  ],
  "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
  "imagePullPolicy": "Always",
  "name": "httpd",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

=> rollback to example-1 from console
$ oc get rc
NAME        DESIRED   CURRENT   READY   AGE
example-1   0         0         0       6m9s
example-2   0         0         0       4m1s
example-3   1         1         1       80s
$ oc get rc example-3 -o json | jq '.spec.template.spec.containers[0]'     // all configurations are rollbacked to be the same with example-1
{
  "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
  "imagePullPolicy": "Always",
  "name": "httpd",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

==> rollback to example-2 from console
$ oc get rc example-4 -o json | jq '.spec.template.spec.containers[0]'      // all configurations are rollbacked to be the same with example-2
{
  "env": [
    {
      "name": "testkey1",
      "value": "testkey2"
    }
  ],
  "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
  "imagePullPolicy": "Always",
  "name": "httpd",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

==> update DC spec.selector to 2 and spec.selector to httpd-test, this will trigger a new deployment
$ oc get rc
NAME        DESIRED   CURRENT   READY   AGE
example-1   0         0         0       10m
example-2   0         0         0       8m11s
example-3   0         0         0       5m30s
example-4   0         0         0       3m27s
example-5   2         2         2       30s
$ oc get rc example-5 -o json | jq '.spec'
{
  "replicas": 2,
  "selector": {
    "app": "httpd-test",
    "deployment": "example-5",
    "deploymentconfig": "example"
  ....
    },
    "spec": {
      "containers": [
        {
          "env": [
            {
              "name": "testkey1",
              "value": "testkey2"
            }
          ],
          "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
          "imagePullPolicy": "Always",
          "name": "httpd",
          ....
    }
  }
}

===> rollback to example-1 and choose 'Replica count and selector', this will trigger a new deployment   // all configurations are rollbacked to be the same with example-1, especially replicas and selector
$ oc get rc
NAME        DESIRED   CURRENT   READY   AGE
example-1   0         0         0       14m
example-2   0         0         0       12m
example-3   0         0         0       9m36s
example-4   0         0         0       7m33s
example-5   0         0         0       4m36s
example-6   3         3         3       21s

$ oc get rc example-6 -o json | jq '.spec.replicas'
3
$ oc get rc example-6 -o json | jq '.spec.selector'
{
  "app": "httpd",
  "deployment": "example-6",
  "deploymentconfig": "example"
}
$ oc get rc example-6 -o json | jq '.spec.template.spec.containers[0]'
{
  "image": "image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest",
  "imagePullPolicy": "Always",
  "name": "httpd",
  "ports": [
    {
      "containerPort": 8080,
      "protocol": "TCP"
    }
  ],
  "resources": {},
  "terminationMessagePath": "/dev/termination-log",
  "terminationMessagePolicy": "File"
}

This has been tested against the open PR and works fine

Comment 9 errata-xmlrpc 2021-07-27 22:56:00 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 (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), 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/RHSA-2021:2438


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