Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1525224

Summary: ReplicationController template processed in 3.8 cannot be used in oc create - cannot unmarshall string for ReplicationControllerSpec.replicas
Product: OpenShift Container Platform Reporter: Mike Fiedler <mifiedle>
Component: MasterAssignee: Juan Vallejo <jvallejo>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: low Docs Contact:
Priority: medium    
Version: 3.8.0CC: aos-bugs, jliggitt, jokerman, jvallejo, mmccomas, smunilla
Target Milestone: ---Keywords: Regression
Target Release: 3.9.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: v3.9.0-0.47.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-18 14:41:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Fiedler 2017-12-12 20:30:42 UTC
Description of problem:

A template which was valid in OCP 3.7 cannot be successfully processed in OCP 3.8.   The template (https://github.com/openshift/svt/blob/master/openshift_scalability/content/logtest/logtest-rc.json) contains a field for REPLICAS   processing the template with 

oc process -f logtest-rc.json -p REPLICAS=3  | oc create -f -

and 

oc process -f logtest-rc.json -p REPLICAS="3" | oc create -f -

both yield:

Error from server (BadRequest): ReplicationController in version "v1" cannot be handled as a ReplicationController: json: cannot unmarshal string into Go struct field ReplicationControllerSpec.replicas of type int32  

Removing the quotes for replicas inside the template itself causes oc process to fail.

This template works fine in OCP 3.7.   How to pass the REPLICAS parameter in 3.8?


Version-Release number of selected component (if applicable): v3.8.18


How reproducible: Always


Steps to Reproduce:
1. Install v3.8.18
2. Download https://github.com/openshift/svt/blob/master/openshift_scalability/content/logtest/logtest-rc.json
3. oc process -f logtest-rc.json -p REPLICAS=3 | oc create -f -

Actual results:

Error from server (BadRequest): ReplicationController in version "v1" cannot be handled as a ReplicationController: json: cannot unmarshal string into Go struct field ReplicationControllerSpec.replicas of type int32

Expected results:

Successful creation of the RC

Additional info:

Comment 1 Xingxing Xia 2017-12-13 02:51:15 UTC
Can reproduce above in oc/OCP 3.8 while oc/OCP 3.7 work well
Not only rc, it is also same for dc. When the int field's value is string, v3.8 shows above error, but v3.7 handles well, thus v3.8 is better to handle it well too

PS: similarly, bug 1270675 now does not happen in v3.7 while happening in v3.8:
$ oc run mydc --image aosqe/hello-openshift --overrides='{ "apiVersion": "v1", "spec": { "replicas": "2"} }'  # in oc/OCP v3.7
deploymentconfig "mydc" created

$ oc run mydc --image aosqe/hello-openshift --overrides='{ "apiVersion": "v1", "spec": { "replicas": "2"} }'  # in oc/OCP v3.8
error: json: cannot unmarshal string into Go struct field DeploymentConfigSpec.replicas of type int32

Comment 2 Juan Vallejo 2017-12-13 22:33:16 UTC
> Can reproduce above in oc/OCP 3.8 while oc/OCP 3.7 work well
> Not only rc, it is also same for dc. When the int field's value is string, v3.8 
> shows above error, but v3.7 handles well, thus v3.8 is better to handle it well 
> too

This bug does not appear to happen when testing oc 3.8 against a 3.7 cluster either, which leads me to believe this may have to do with a change in the server as of 3.8. Will keep looking into this

Comment 3 Juan Vallejo 2017-12-13 23:12:48 UTC
This bug is related to https://bugzilla.redhat.com/show_bug.cgi?id=1525162 (they both have the same cause).

Origin PR: https://github.com/openshift/origin/pull/17768

Comment 4 Jordan Liggitt 2017-12-13 23:27:55 UTC
To be clear, the template is invalid. Prior versions accidentally excepted invalid data and coerced strings two numbers. We should sweep and fix any templates and examples and documentation under our control

Comment 5 Jordan Liggitt 2017-12-13 23:29:43 UTC
Voice dictation strikes again.

Comment 6 Juan Vallejo 2017-12-18 21:41:57 UTC
https://github.com/openshift/origin/pull/17768 has merged - lowering severity instead of closing to track https://bugzilla.redhat.com/show_bug.cgi?id=1525224#c4

Comment 7 Wang Haoran 2018-02-22 02:50:43 UTC
Verified with:
oc v3.9.0-0.47.0
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://172.16.120.78:8443
openshift v3.9.0-0.47.0
kubernetes v1.9.1+a0ce1bc657