Fix `create_pod` for 4.0 kubernetes client

4.0 version of kubernetes pypi package was released. It changes the
V1Container and V1PodSpec parameter validation and now requires name and
containers fields respectively to always be provided to the
constructors. This commit fixes that.

A successful run of the fix agains kuryr-kubernetes repo can be seen on
Ie282feac157f454b61fd259a3e122fbf97199950.

Closes-Bug: 1733538
Change-Id: I96d2ad16033fa0ebac0f97b0f7d28ed3f933e227
This commit is contained in:
Michał Dulko 2017-11-21 09:56:59 +01:00
parent 0a820212fe
commit e6c01efdc4
1 changed files with 2 additions and 4 deletions

View File

@ -57,13 +57,11 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
pod = self.k8s_client.V1Pod()
pod.metadata = self.k8s_client.V1ObjectMeta(name=name)
container = self.k8s_client.V1Container()
container = self.k8s_client.V1Container(name=name)
container.image = image
container.args = ["sleep", "3600"]
container.name = name
spec = self.k8s_client.V1PodSpec()
spec.containers = [container]
spec = self.k8s_client.V1PodSpec(containers=[container])
pod.spec = spec
self.k8s_client.CoreV1Api().create_namespaced_pod(namespace=namespace,