Bug 1750494 - Improve error message when apiVersion is mispelled: no version was provided
Summary: Improve error message when apiVersion is mispelled: no version was provided
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.3.0
Assignee: Patrick Dillon
QA Contact: gaoshang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-09 17:41 UTC by Robert Bost
Modified: 2020-01-23 11:06 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: validation of api version was using a different library than other validation code. Consequence: when an incorrect api version was provided, an error message was presented but the field was not specified, so the user did not know the error message referred to the apiversion. Fix: update the code to use the same package as other validation packages. Result: when there is an error in the apiversion, the error message indicates that the error pertains to the apiversion field.
Clone Of:
Environment:
Last Closed: 2020-01-23 11:05:47 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift installer pull 2434 'None' closed Bug 1750494: Use standard field validation in pkg/types/conversion/ 2020-09-12 04:50:01 UTC
Red Hat Knowledge Base (Solution) 4401381 None None None 2019-09-09 17:41:23 UTC
Red Hat Product Errata RHBA-2020:0062 None None None 2020-01-23 11:06:11 UTC

Description Robert Bost 2019-09-09 17:41:23 UTC
Description of problem: Missing or mispelling apiVersion in install config is confusing:

  FATAL failed to fetch Kubeconfig Admin Client: failed to load asset "Install Config": failed to upconvert install config: no version was provided

There have already been two similar bugs filed on this: bz1722221 and 1723565.

Can the error message clearly state to end users that the version flag in question is "apiVersion"? Plainly stating the field name in question would lead to better user experience.


Version-Release:
./openshift-install v4.1.13-201908210601-dirty
built from commit 6adb6573695331c5dd7c660f6a0131013c816ec1
release image quay.io/openshift-release-dev/ocp-release@sha256:212296a41e04176c308bfe169e7c6e05d77b76f403361664c3ce55cd30682a94

Comment 3 gaoshang 2019-10-16 08:14:44 UTC
This bug has been verified and passed on openshift build 4.3.0-0.nightly-2019-10-16-010826, change status to VERIFIED.

Version-Release:
4.3.0-0.nightly-2019-10-16-010826
# ./openshift-install version
./openshift-install v4.3.0
built from commit b63593362e750d4a92edf5ec0d260618a102e754
release image registry.svc.ci.openshift.org/ocp/release@sha256:d9c36fb738d5aecae427b4cf5b630be6ba30eeefc36e583c0ded60057df44ed9

Steps:
1. Create install config
# ./openshift-install create --dir=$DIR_NAME install-config

2. Modify install-config.yaml, remove apiVersion value and create cluster, check error message
# head -n 1 cluster-0/install-config.yaml
apiVersion: 

# ./openshift-install create cluster --dir cluster-0/ --log-level debug
DEBUG OpenShift Installer v4.3.0                   
DEBUG Built from commit b63593362e750d4a92edf5ec0d260618a102e754 
DEBUG Fetching Terraform Variables...              
DEBUG Loading Terraform Variables...               
DEBUG   Loading Cluster ID...                      
DEBUG     Loading Install Config...                
DEBUG       Loading SSH Key...                     
DEBUG       Using SSH Key loaded from state file   
DEBUG       Loading Base Domain...                 
DEBUG         Loading Platform...                  
DEBUG         Using Platform loaded from state file 
DEBUG       Using Base Domain loaded from state file 
DEBUG       Loading Cluster Name...                
DEBUG         Loading Base Domain...               
DEBUG       Using Cluster Name loaded from state file 
DEBUG       Loading Pull Secret...                 
DEBUG       Using Pull Secret loaded from state file 
DEBUG       Loading Platform...                    
FATAL failed to fetch Terraform Variables: failed to load asset "Install Config": failed to upconvert install config: apiVersion: Required value: no version was provided

3. Modify install-config.yaml, remove apiVersion all line and create cluster, check error message
# head -n 1 cluster-0/install-config.yaml
baseDomain: qe.devcluster.openshift.com

# ./openshift-install create cluster --dir cluster-0/ --log-level debug
DEBUG OpenShift Installer v4.3.0                   
DEBUG Built from commit b63593362e750d4a92edf5ec0d260618a102e754 
DEBUG Fetching Terraform Variables...              
DEBUG Loading Terraform Variables...               
DEBUG   Loading Cluster ID...                      
DEBUG     Loading Install Config...                
DEBUG       Loading SSH Key...                     
DEBUG       Using SSH Key loaded from state file   
DEBUG       Loading Base Domain...                 
DEBUG         Loading Platform...                  
DEBUG         Using Platform loaded from state file 
DEBUG       Using Base Domain loaded from state file 
DEBUG       Loading Cluster Name...                
DEBUG         Loading Base Domain...               
DEBUG       Using Cluster Name loaded from state file 
DEBUG       Loading Pull Secret...                 
DEBUG       Using Pull Secret loaded from state file 
DEBUG       Loading Platform...                    
FATAL failed to fetch Terraform Variables: failed to load asset "Install Config": failed to upconvert install config: apiVersion: Required value: no version was provided 


4. Modify install-config.yaml again, set wrong apiVersion and create cluster, check error message
# head -n 1 cluster-0/install-config.yaml
apiVersion: ddd

# ./openshift-install create cluster --dir cluster-0/ --log-level debug
DEBUG OpenShift Installer v4.3.0                   
DEBUG Built from commit b63593362e750d4a92edf5ec0d260618a102e754 
DEBUG Fetching Terraform Variables...              
DEBUG Loading Terraform Variables...               
DEBUG   Loading Cluster ID...                      
DEBUG     Loading Install Config...                
DEBUG       Loading SSH Key...                     
DEBUG       Using SSH Key loaded from state file   
DEBUG       Loading Base Domain...                 
DEBUG         Loading Platform...                  
DEBUG         Using Platform loaded from state file 
DEBUG       Using Base Domain loaded from state file 
DEBUG       Loading Cluster Name...                
DEBUG         Loading Base Domain...               
DEBUG       Using Cluster Name loaded from state file 
DEBUG       Loading Pull Secret...                 
DEBUG       Using Pull Secret loaded from state file 
DEBUG       Loading Platform...                    
FATAL failed to fetch Terraform Variables: failed to load asset "Install Config": failed to upconvert install config: apiVersion: Invalid value: "ddd": cannot upconvert from version ddd

Comment 5 errata-xmlrpc 2020-01-23 11:05: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-2020:0062


Note You need to log in before you can comment on or make changes to this bug.