Bug 1250652

Summary: oc scale doesn't work against dc (when no rc is present)
Product: OpenShift Container Platform Reporter: Erik M Jacobs <ejacobs>
Component: ocAssignee: Michail Kargakis <mkargaki>
Status: CLOSED ERRATA QA Contact: Yanping Zhang <yanpzhan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: ccoleman, dmcphers, jokerman, libra-bugs, libra-onpremise-devel, mmccomas, pruan, wsun
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-3.0.1.900-0.git.251.56c53fd.el7ose.x86_64 Doc Type: Enhancement
Doc Text:
Feature: Users may now specify the replica count by adjusting the scale of a deployment config. Reason: Users may wish to set the replica count before a replication controller has been created. Result: Users may now set the replica count on a deployment config and that value will be used for replication controllers created in the future.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-22 19:52:47 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 Erik M Jacobs 2015-08-05 16:49:11 UTC
it appears that "oc scale" can't be used on a dc -- only an rc.

For example:

oc get rc (there are none)

oc get dc
NAME      TRIGGERS                    LATEST VERSION
smoke     ConfigChange, ImageChange   0

oc scale dc/smoke -n user00-smoke --replicas=2
error: Scaling the controller failed with: replicationControllers "smoke-0" not found; Current resource version Unknown

It would be nice if scaling the DC set the number of replicas for the deployments "permanently".

Comment 2 Erik M Jacobs 2015-08-05 17:03:05 UTC
Once there is finally at least one RC, this works:

[root@ip-172-18-1-171 ~]# oc get dc -n user00-smoke
NAME      TRIGGERS                    LATEST VERSION
smoke     ConfigChange, ImageChange   1
[root@ip-172-18-1-171 ~]# oc scale dc/smoke -n user00-smoke --replicas=2
scaled
[root@ip-172-18-1-171 ~]# oc get rc -n user00-smoke
CONTROLLER   CONTAINER(S)   IMAGE(S)                                                                                                        SELECTOR                                    REPLICAS
smoke-1      smoke          172.30.109.25:5000/user00-smoke/smoke@sha256:8a8073f1593718b0876f292be45deebb763c3138a40ff546e89d3d5d7a28dc83   deployment=smoke-1,deploymentconfig=smoke   2
[root@ip-172-18-1-171 ~]# 

Why should it be the case that we don't "allow" scaling of the DC before the first deployment?

Comment 3 Clayton Coleman 2015-08-05 17:33:45 UTC
There is no such "permanent".  There is only "the current scale number" which we have decided is owned by the RC (to allow other components to coexist, like autoscaling).

oc scale dc without any deployments should work which definitely needs to be fixed.

Comment 4 Erik M Jacobs 2015-08-05 17:37:52 UTC
agreed - the current scale number is owned by the rc.

However, the dc owns the future scale number, which is why someone might want to scale the dc before there's an rc -- I've just created an app for an A/B test and I know I want to immediately scale to 20% of the size of the existing app.

That's the reasoning for wanting to scale the dc before there's an actual deployment.

Comment 5 openshift-github-bot 2015-09-09 17:49:24 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/816cee1ffb2c412d866b5482673ba33651249bdd
Bug 1250652: Scale dc template in case of no deployment

Comment 6 Wei Sun 2015-09-10 05:16:00 UTC
Check this bug against devenv-fedora_2313

[fedora@ip-172-18-4-135 ~]$ oc get dc
NAME        TRIGGERS                    LATEST VERSION
nodejs-ex   ConfigChange, ImageChange   0
[fedora@ip-172-18-4-135 ~]$ oc scale dc/nodejs-ex -n wsuntest --replicas=2
I0910 04:42:00.269628   17905 scale.go:42] No deployment found for dc/nodejs-ex. Scaling the deployment configuration template...
deploymentconfig "nodejs-ex" scaled
[fedora@ip-172-18-4-135 ~]$ oc scale dc/nodejs-ex -n wsuntest --replicas=2
deploymentconfig "nodejs-ex" scaled
[fedora@ip-172-18-4-135 ~]$ oc get dc
NAME        TRIGGERS                    LATEST VERSION
nodejs-ex   ConfigChange, ImageChange   1
[fedora@ip-172-18-4-135 ~]$ oc get rc
CONTROLLER    CONTAINER(S)   IMAGE(S)                                                                                                        SELECTOR                                            REPLICAS   AGE
nodejs-ex-1   nodejs-ex      172.30.147.56:5000/wsuntest/nodejs-ex@sha256:f958e41765abaff0b1d1d364278b70b8dc6f8d53200a6a62adf21c4291a55a7c   deployment=nodejs-ex-1,deploymentconfig=nodejs-ex   2          31m

Will check this bug on ose env after the pr is merged to ose

Comment 8 Wei Sun 2015-09-11 05:03:33 UTC
Verified against the latest ose env

[wsun@dhcp-9-84 v3test]$ openshift version
openshift v3.0.1.900-251-g56c53fd
kubernetes v1.1.0-alpha.0-1605-g44c91b1

[wsun@dhcp-9-84 v3test]$ oc get rc
CONTROLLER   CONTAINER(S)   IMAGE(S)   SELECTOR   REPLICAS   AGE
[wsun@dhcp-9-84 v3test]$ oc get dc
NAME        TRIGGERS                    LATEST VERSION
nodejs-ex   ConfigChange, ImageChange   0
[wsun@dhcp-9-84 v3test]$ oc scale dc/nodejs-ex --replicas=2
I0911 11:34:37.568343    5411 scale.go:42] No deployment found for dc/nodejs-ex. Scaling the deployment configuration template...
deploymentconfig "nodejs-ex" scaled

Comment 10 errata-xmlrpc 2015-09-22 19:52:47 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-2015:1835