Skip to content

Commit

Permalink
Add a message about kubernetes version not being supported
Browse files Browse the repository at this point in the history
Return an error if validation is attempted against a very
old/very new version of kubernetes

This is an error to force the user to either upgrade/downgrade
their version of kubernetes-validate or turn off validation
  • Loading branch information
willthames authored and fabianvf committed Feb 3, 2019
1 parent 1672216 commit 7444366
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openshift/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ def validate(self, definition, version=None, strict=False):
kubernetes_validate.validate(definition, version, strict)
except kubernetes_validate.utils.ValidationError as e:
errors.append("resource definition validation error at %s: %s" % ('.'.join([str(item) for item in e.path]), e.message)) # noqa: B306
except kubernetes_validate.utils.VersionNotSupportedError as e:
errors.append("Kubernetes version %s is not supported by kubernetes-validate" % version)
except kubernetes_validate.utils.SchemaNotFoundError as e:
warnings.append("Could not find schema for object kind %s with API version %s in Kubernetes version %s (possibly Custom Resource?)" %
(e.kind, e.api_version, e.version))
Expand Down

0 comments on commit 7444366

Please sign in to comment.