Bug 1831717

Summary: Unknown object type "nil" in MachineSet.spec.template.spec.providerSpec.value.publicIp
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: low    
Version: 4.5   
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: An empty value in the provider spec was being marshalled to null by the JSON encoder Consequence: The value became a string, when it should have been a bool Fix: Allow the JSON encoder to ignore the value if it was empty Result: The value is no longer rendered as the string null
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:35:00 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 Joel Speed 2020-05-05 14:21:20 UTC
Description of problem:

A freshly installed cluster will create MachineSets with `publicIp: null` as the value is not specified and the JSON encoder attempts to encode the nil value.

This causes errors if a user tries to edit the MachineSet `oc edit machineset`

Version-Release number of selected component (if applicable): 4.5


How reproducible: Very


Steps to Reproduce:
1. Create a cluster
2. Check that the MachineSet has a value for publicIp
3. Attempt to edit the MachineSet eg, add `spotMarketOptions: {}` to the providerSpec.value

Actual results:

Returns an error: 
```
Unknown object type "nil" in MachineSet.spec.template.spec.providerSpec.value.publicIp
```

Expected results:
Modifications should be accepted without issue


Additional info:

Comment 3 Milind Yadav 2020-05-14 09:36:56 UTC
Validated on:
 
[miyadav@miyadav bugaws]$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.5.0-0.nightly-2020-05-12-224129   True        False         27h     Cluster version is 4.5.0-0.nightly-2020-05-12-224129


As per the fix the default installation did not had publicIp: true 

Additional Info to validate we dont get error while editing machineset

Steps : 
1. oc get machineset
 NAME                                  DESIRED   CURRENT   READY   AVAILABLE   AGE
zhsunaws513-j6sch-worker-us-east-2a   1         1         1       1           30h
zhsunaws513-j6sch-worker-us-east-2b   1         1         1       1           30h
zhsunaws513-j6sch-worker-us-east-2c   1         1         1       1           30h

[miyadav@miyadav bugvsphere]$ oc edit machineset zhsunaws513-j6sch-worker-us-east-2a 

Updating machinset with  below :

.
.
    spec:
      metadata: {}
      providerSpec:
        value:
          spotMarketOptions:
              maxPrice: "0.01"
          
Actual & Expected :
machineset.machine.openshift.io/zhsunaws513-j6sch-worker-us-east-2a edited

2.oc describe machineset zhsunaws513-j6sch-worker-us-east-2a
.
  Placement:
            Availability Zone:  us-east-2a
            Region:             us-east-2
          Security Groups:
            Filters:
              Name:  tag:Name
              Values:
                zhsunaws513-j6sch-worker-sg
          Spot Market Options:
            Max Price:  0.01
          Subnet:
            Filters:
              Name:  tag:Name
              Values:
                zhsunaws513-j6sch-private-us-east-2a
          Tags:
            Name:   kubernetes.io/cluster/zhsunaws513-j6sch
            Value:  owned
          User Data Secret:
            Name:  worker-user-data
Status:
  Available Replicas:      1
  Fully Labeled Replicas:  1
  Observed Generation:     2
  Ready Replicas:          1
  Replicas:                1
Events:                    <none>.
.
.

Moving to VERIFIED

Comment 4 errata-xmlrpc 2020-07-13 17:35: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, 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:2409