Add compatibility with old Pod annotations

In Rocky we've changed format of Pod annotations. This commit adds
compatiblity with stable/queens format to make sure plugin works on that
branch.

Change-Id: I99acb29ffb64f42e61ca17b0aec24976a61510eb
This commit is contained in:
Michał Dulko 2018-07-19 12:44:40 +02:00
parent 8221aaef31
commit edda7f9fb4
1 changed files with 6 additions and 1 deletions

View File

@ -119,7 +119,12 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
namespace=namespace, name=pod_name)
kuryr_if = json.loads(pod.metadata.annotations[
'openstack.org/kuryr-vif'])
return kuryr_if['eth0']['versioned_object.data']['id']
# FIXME(dulek): We need this compatibility code to run stable/queens.
# Remove this once it's no longer supported.
kuryr_if = kuryr_if.get('eth0', kuryr_if)
return kuryr_if['versioned_object.data']['id']
def exec_command_in_pod(self, pod_name, command, namespace="default"):
api = self.k8s_client.CoreV1Api()