-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make local hostname (edge2ai-x.dim.local) unique for multi-cluster de…
…ployments. Before this change all clusters in a multi-cluster deployment would have the same local hostname (edge2ai-1.dim.local). Now those names are unique per host and have the format edge2ai-X.dim.local, where X is the cluster ID.
- Loading branch information
Showing
17 changed files
with
109 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,10 @@ | |
from datetime import datetime | ||
from optparse import OptionParser | ||
import cm_client | ||
import json | ||
import os | ||
import re | ||
import requests | ||
import sys | ||
import socket | ||
import time | ||
import urllib3 | ||
|
||
|
@@ -90,7 +89,7 @@ def cm_version(): | |
|
||
def the_pwd(): | ||
return os.environ['THE_PWD'] | ||
|
||
def cluster_id(): | ||
try: | ||
if 'CLUSTER_ID' in os.environ: | ||
|
@@ -100,6 +99,9 @@ def cluster_id(): | |
|
||
return 0 | ||
|
||
def local_hostname(): | ||
return os.environ.get('LOCAL_HOSTNAME', 'edge2ai-1.local.dim') | ||
|
||
class ClusterCreator: | ||
def __init__(self, host, krb_princ='scm/[email protected]', tls_ca_cert=None): | ||
self.host = host | ||
|
@@ -273,7 +275,7 @@ def setup_cm(self, key_file, cm_repo_url, use_kerberos, use_tls, kerberos_type, | |
|
||
# Update cluster banner | ||
c_id = cluster_id() | ||
banner = 'CLUSTER_{}'.format(c_id) | ||
banner = 'Cluster ID: {}, Host: {}'.format(c_id, socket.gethostname()) | ||
header_color = HEADER_COLORS[c_id % len(HEADER_COLORS)] | ||
self.cm_api.update_config( | ||
message='Customizing CM header and banner', | ||
|
@@ -339,8 +341,8 @@ def _enable_kerberos(self, kerberos_type, ipa_host): | |
] | ||
if kerberos_type == 'MIT': | ||
config += [ | ||
cm_client.ApiConfig(name='KDC_ADMIN_HOST', value='edge2ai-1.dim.local'), | ||
cm_client.ApiConfig(name='KDC_HOST', value='edge2ai-1.dim.local'), | ||
cm_client.ApiConfig(name='KDC_ADMIN_HOST', value=local_hostname()), | ||
cm_client.ApiConfig(name='KDC_HOST', value=local_hostname()), | ||
cm_client.ApiConfig(name='KDC_TYPE', value='MIT KDC'), | ||
] | ||
else: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.