Sometimes, minikube lags behind kubernetes which can lead
to a breakage of the test suite, since minikube will fail to start
with the latest kubernetes version.
See for example [this issue](https://github.com/kubernetes/minikube/issues/4371).
This change defaults to leave the decision of which k8s version to use,
to minikube itself. This is defined in:
https://github.com/kubernetes/minikube/master/pkg/minikube/constants/constants.go
However, if one really desires it is still possible to pass
`--kubernetes-version=X.Y.Z`
to minikube initialization start command via an environment variable
before invoking the test suite:
export $MINIKUBE_ARGS="--kubernetes-version=X.Y.Z"
This allows ofcourse passing other flags to minikube also.
Adding the ability to deal with strings containing yaml seems to repel
to much. So we stay with create_from_yaml with a bad name.
This removes the need fro StringIO to wrap strings.
Also note:
```
with open('foo.txt') as f:
y = yaml.safe_load_all(f)
for i in y:
print(i)
\# raises ValueError: I/O operation on closed file.
```
Hence, we indent the whole method body into the open block.
with open('foo.txt') as f:
y = yaml.safe_load_all(f)
for i in y:
print(i)
The function can create one or more Kuberenetes objects
based on the content of data. It can handle all API objects
incuding `List` type, which by itself can contain more than
one Kuberenetes API objects.
Renaming `yml_document` in `create_from_dict` to data. This is a bit
clearer that this it a data item and not a string (usually document
read from the file system).
Also update the documentation to describe better what the functions
`create_from_dict` and `create_from_yaml` do.
Some models don't have attribute 'status', like V1ConfigMap,
V1ClusterRole, and V1NetworkPolicy. AttributeError would be raised if
these resources are created via create_from_yaml with verbose enabled.
This patch checks if attribute 'status' exists before accessing it.
All our libraries that depended on `kubernetes` started breaking today.
The reason is that pip does not do a good job properly resolving the compatible package versions.
It just install packages in order without caring about the incompatibilities.
The urllib3 package installed is incompatible with the `requests` package that's getting installed later.
Changing the order fixes the issue.
While this is a really good convention, sometimes one must import
stuff inside a try except block. This block is still at the top, but pycodestyle
treats like it isn't, because it's in an idented block, and the outeer scope.