origin: Improve high level yaml/json parsing and error handling

Sometimes well-formed yaml/json files don’t conform to openshift/kubernetes data structure. My DeploymentConfig was missing containers key and as a result I got a cryptic yaml parsing error: DeploymentConfig: only encoded map or array can be decoded into a struct. The error is too vague to novice users.

Version

openshift v3.3.0.4 kubernetes v1.3.0+57fb9ac etcd 2.3.0+git

Steps To Reproduce
    template:
      metadata:
        labels:
          name: ${NAME}
        name: ${NAME}
      spec:
       containers:
       - image: docker.io/hawkularqe/hawkular-services:latest

remove containers:

Current Result

DeploymentConfig in version “v1” cannot be handled as a DeploymentConfig: only encoded map or array can be decoded into a struct.

Expected Result

A friendly message such as “Missing Containers object” would greatly improve the user experience.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 15
  • Comments: 15 (9 by maintainers)

Most upvoted comments

You mean like --validate? We default it to off today in oc, but you can still specify it.

We should probably start turning validate on by default now that all the schema stuff is fixed end to end (if explain works, validate should work).