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" }
I assume if we didn't choose any additional options in Rollback modal, default rollback behavior should be applied
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
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