Skip to content

Commit

Permalink
For k8s multi cluster support, the project names will be prepended by
Browse files Browse the repository at this point in the history
cluster name of kubernetes.

Thus, making corresponding changes in the test infra to handle it.

Change-Id: I681724e6de0c6c1f5fb47c8735dbe1e0a4088e90
Closes-bug: #1778179
  • Loading branch information
pulkitt committed Jun 23, 2018
1 parent bfc3f0d commit 0603e8f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions common/contrail_test_init.py
Expand Up @@ -839,10 +839,14 @@ def parse_yml_file(self):
self.authn_url = '/v3/auth/tokens'
else:
self.authn_url = '/v2.0/tokens'
if self.orchestrator == 'kubernetes':
self.admin_tenant = 'default'
self.internal_vip = orchestrator_configs.get('internal_vip')
self.external_vip = orchestrator_configs.get('external_vip') or self.internal_vip

#kubernetes specific configs
self.k8s_cluster_name = contrail_configs.get('KUBERNETES_CLUSTER_NAME') or "k8s"
if self.orchestrator == 'kubernetes':
self.admin_tenant = self.k8s_cluster_name + '_default'

# test specific configs
self.auth_url = test_configs.get('auth_url') or os.getenv('OS_AUTH_URL',
self._gen_auth_url())
Expand Down
7 changes: 4 additions & 3 deletions common/k8s/base.py
Expand Up @@ -1058,16 +1058,17 @@ def modify_cluster_project(self, project_name = None):
if not cp_line or no_match:
self.logger.debug("Cluster_project not set in this sanity run. "
"Setting it to default project for few tests")
cmd = r'crudini --set /entrypoint.sh KUBERNETES cluster_project \\${KUBERNETES_CLUSTER_PROJECT:-\\"{\'domain\':\'default-domain\'\,\'project\':\'default\'}\\"}'
default_project = self.inputs.admin_tenant
cmd = r'crudini --set /entrypoint.sh KUBERNETES cluster_project \\${KUBERNETES_CLUSTER_PROJECT:-\\"{\'domain\':\'default-domain\'\,\'project\':\'%s\'}\\"}'\
% default_project
operation = "set"
project = "default"
for kube_manager in self.inputs.kube_manager_ips:
self.inputs.run_cmd_on_server(kube_manager, cmd,
container='contrail-kube-manager',
shell_prefix = None)
self.restart_kube_manager()
self.addCleanup(self.revert_cluster_project,
project_name = project,
project_name = default_project,
operation = operation)
return operation
#end modify_cluster_project
Expand Down
2 changes: 1 addition & 1 deletion fixtures/k8s/namespace.py
Expand Up @@ -98,7 +98,7 @@ def get_project_name_for_namespace(self):
if project:
return project
else:
return self.name
return self.inputs.k8s_cluster_name + "_" + self.name

@retry(delay=2, tries=10)
def verify_namespace_in_contrail_api(self):
Expand Down

0 comments on commit 0603e8f

Please sign in to comment.