Provide Kubernetes resource validation to k8s module (#43352)

* Provide Kubernetes resource validation to k8s module

Use kubernetes-validate to validate Kubernetes resource
definitions against the published schema

* Additional tests for kubernetes-validate

* Improve k8s error messages on exceptions

Parse the response body for the message rather than returning
a JSON blob

If we've validated and there are warnings, return those too - they
can be more helpful

```
"msg": "Failed to patch object: {\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},
       \"status\":\"Failure\",\"message\":\"[pos 334]: json: decNum: got first char 'h'\",\"code\":500}\n",
```
vs
```
"msg": "Failed to patch object: [pos 334]: json: decNum: got first char 'h'\nresource
        validation error at spec.replicas: 'hello' is not of type u'integer'",
```

* Update versions used

In particular openshift/origin:3.9.0

* Add changelog for k8s validate change
This commit is contained in:
Will Thames 2018-11-16 22:44:59 +10:00 committed by John R Barker
parent ae0054a79e
commit aaf29c785f
11 changed files with 355 additions and 22 deletions

View file

@ -44,7 +44,7 @@ class OpenShiftCloudProvider(CloudProvider):
super(OpenShiftCloudProvider, self).__init__(args, config_extension='.kubeconfig')
# The image must be pinned to a specific version to guarantee CI passes with the version used.
self.image = 'openshift/origin:v3.7.1'
self.image = 'openshift/origin:v3.9.0'
self.container_name = ''
def filter(self, targets, exclude):