Bug 1827307

Summary: MachineSet replicas should default to 1
Product: OpenShift Container Platform Reporter: Joel Speed <jspeed>
Component: Cloud ComputeAssignee: Joel Speed <jspeed>
Cloud Compute sub component: Other Providers QA Contact: Milind Yadav <miyadav>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agarcial, deads, hongkliu, jhou, jspeed, mgugino, zhsun
Version: 4.5   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: No defaulting had been implemented for the replicas field. Consequence: A user could remove the replicas field which would break the MachineSet controller but not return any errors to the user. Fix: If the user does not provide a value for replicas, it will default to 1. This will not interfere with oc apply. Result: The MachineSet controller will no longer be blocked. Replicas will default to 1 as per documented behaviour.
Story Points: ---
Clone Of: 1820654 Environment:
Last Closed: 2020-10-27 15:58:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1819029, 1820654, 1852061    
Bug Blocks:    

Comment 3 Alberto 2020-05-29 10:54:53 UTC
tagging with upcomingSprint to re-evaluate priority.

Comment 4 Joel Speed 2020-06-17 10:21:17 UTC
We have implemented defaulting for the ProviderSpec this sprint. Will take a look at this and the impact of the change next sprint

Comment 5 Joel Speed 2020-07-06 10:40:29 UTC
I want to make sure that everything is stable from the webhook side before we start digging into this. There's been a few teething issues to look into so dropping this to next sprint

Comment 6 Joel Speed 2020-07-30 15:41:05 UTC
Didn't manage to look into this during the last sprint, should have more time to get to this after feature freeze

Comment 7 Joel Speed 2020-08-20 16:45:32 UTC
Need consensus from the team that this is the right way to go, will try to push this through next sprint

Comment 10 Milind Yadav 2020-09-02 12:44:32 UTC
VERIFIED on - 4.6.0-0.nightly-2020-08-31-220837

Steps :
1.Created a machineset with replicas as below- 
.
.
.
spec:
  replicas:
  selector:
    matchLabels:
      machine.openshift.io/cluster-api-cluster: wduan0902b-9kmnz
      machine.openshift.io/cluster-api-machineset: wduan0902b-9kmnz-worker-new
  template:
    metadata:
      labels:
        machine.openshift.io/cluster-api-cluster: wduan0902b-9kmnz
        machine.openshift.io/cluster-api-machine-role: worker
        machine.openshift.io/cluster-api-machine-type: worker
        machine.openshift.io/cluster-api-machineset: wduan0902b-9kmnz-worker-new
.
..
.
2. Machineset created successfully 
[miyadav@miyadav vsphere]$ oc create -f vsp_ms.yaml --config vsp 
machineset.machine.openshift.io/wduan0902b-9kmnz-worker-new created

3.Machines in machineset scaled successfully
[miyadav@miyadav vsphere]$ oc get machineset --config vsp
NAME                          DESIRED   CURRENT   READY   AVAILABLE   AGE
wduan0902b-9kmnz-worker       2         2         2       2           5h26m
wduan0902b-9kmnz-worker-new   1         1         1       1           7m19s
[miyadav@miyadav vsphere]$ oc get machines -o wide --config vsp
NAME                                PHASE     TYPE   REGION   ZONE   AGE     NODE                                PROVIDERID                                       STATE
wduan0902b-9kmnz-master-0           Running                          5h26m   wduan0902b-9kmnz-master-0           vsphere://422b9e4d-ab7a-8d15-4ba9-617925baf5e8   poweredOn
wduan0902b-9kmnz-master-1           Running                          5h26m   wduan0902b-9kmnz-master-1           vsphere://422b65da-7976-acd3-21fa-b64e07a408f0   poweredOn
wduan0902b-9kmnz-master-2           Running                          5h26m   wduan0902b-9kmnz-master-2           vsphere://422b0cf9-f6fb-4aee-3da8-68a8d135f869   poweredOn
wduan0902b-9kmnz-worker-7fd7v       Running                          5h16m   wduan0902b-9kmnz-worker-7fd7v       vsphere://422b5f20-6e50-48f4-4ade-4e6d1529a336   poweredOn
wduan0902b-9kmnz-worker-new-8jhld   Running                          7m40s   wduan0902b-9kmnz-worker-new-8jhld   vsphere://422be203-fc3d-71c9-44ed-e7f921cfb85c   poweredOn
wduan0902b-9kmnz-worker-wwv98       Running                          5h16m   wduan0902b-9kmnz-worker-wwv98       vsphere://422ba102-80ee-2319-b00d-c34f0a9293f0   poweredOn
[miyadav@miyadav vsphere]$ 

All results as expected , moved to VERIFIED.

Additional info:
We cannot use "nil" or  nil in replica field  as it is invalid and will through error :
admission webhook "default.machineset.machine.openshift.io" denied the request: v1beta1.MachineSet.Spec: v1beta1.MachineSetSpec.Replicas: readUint32: unexpected character: �, error found in #10 byte of ...|eplicas":"nil","sele|..., bigger context ...|64f4-44e7-9b3f-b32825c9f54e"},"spec":{"replicas":"nil","selector":{"matchLabels":{"machine.openshift|...

Comment 12 errata-xmlrpc 2020-10-27 15:58:27 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 (OpenShift Container Platform 4.6 GA Images), 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-2020:4196