Browse Source

HUE-8586 [cluster] Rename k8 properties to k8s

Romain Rigaux 7 years ago
parent
commit
28d756e506

+ 9 - 9
desktop/core/src/desktop/api2.py

@@ -40,7 +40,7 @@ from notebook.connectors.base import Notebook
 from notebook.views import upgrade_session_properties
 
 from desktop.lib.django_util import JsonResponse
-from desktop.conf import get_clusters, IS_K8_ONLY
+from desktop.conf import get_clusters, IS_K8S_ONLY
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.export_csvxls import make_response
 from desktop.lib.i18n import smart_str, force_unicode
@@ -96,7 +96,7 @@ def get_context_namespaces(request, interface):
     if [cluster for cluster in clusters if cluster['type'] == 'altus']:
       # Note: attaching computes to namespaces might be done via the frontend in the future
       if interface == 'impala':
-        if IS_K8_ONLY.get():
+        if IS_K8S_ONLY.get():
           adb_clusters = DataWarehouse2Api(request.user).list_clusters()['clusters']
         else:
           adb_clusters = AnalyticDbApi(request.user).list_clusters()['clusters']
@@ -106,24 +106,24 @@ def get_context_namespaces(request, interface):
             _cluster['id'] = _cluster['crn']
             _cluster['namespaceName'] = _cluster['clusterName']
             _cluster['name'] = _cluster['clusterName']
-            _cluster['compute_end_point'] = '%(publicHost)s' % _cluster['coordinatorEndpoint'] if IS_K8_ONLY.get() else '',
+            _cluster['compute_end_point'] = '%(publicHost)s' % _cluster['coordinatorEndpoint'] if IS_K8S_ONLY.get() else '',
       else:
         adb_clusters = []
 
-      if IS_K8_ONLY.get():
+      if IS_K8S_ONLY.get():
         sdx_namespaces = []
       else:
         sdx_namespaces = SdxApi(request.user).list_namespaces()
 
       # Adding "fake" namespace for cluster without one
-      sdx_namespaces.extend([_cluster for _cluster in adb_clusters if not _cluster.get('namespaceCrn') or (IS_K8_ONLY.get() and _cluster['status'] == 'ONLINE')])
+      sdx_namespaces.extend([_cluster for _cluster in adb_clusters if not _cluster.get('namespaceCrn') or (IS_K8S_ONLY.get() and _cluster['status'] == 'ONLINE')])
 
       namespaces.extend([{
           'id': namespace.get('crn', 'None'),
           'name': namespace.get('namespaceName'),
           'status': namespace.get('status'),
           'computes': [_cluster for _cluster in adb_clusters if _cluster.get('namespaceCrn') == namespace.get('crn')]
-        } for namespace in sdx_namespaces if namespace.get('status') == 'CREATED' or IS_K8_ONLY.get()
+        } for namespace in sdx_namespaces if namespace.get('status') == 'CREATED' or IS_K8S_ONLY.get()
       ])
 
   response[interface] = namespaces
@@ -150,7 +150,7 @@ def get_context_computes(request, interface):
     ])
 
   if interface == 'impala' or interface == 'report':
-    if IS_K8_ONLY.get():
+    if IS_K8S_ONLY.get():
       dw_clusters = DataWarehouse2Api(request.user).list_clusters()['clusters']
     else:
       dw_clusters = AnalyticDbApi(request.user).list_clusters()['clusters']
@@ -161,9 +161,9 @@ def get_context_computes(request, interface):
           'name': cluster.get('clusterName'),
           'status': cluster.get('status'),
           'namespace': cluster.get('namespaceCrn', cluster.get('crn')),
-          'compute_end_point': IS_K8_ONLY.get() and '%(publicHost)s' % cluster['coordinatorEndpoint'] or '',
+          'compute_end_point': IS_K8S_ONLY.get() and '%(publicHost)s' % cluster['coordinatorEndpoint'] or '',
           'type': 'altus-dw'
-        } for cluster in dw_clusters if (cluster.get('status') == 'CREATED' and cluster.get('cdhVersion') >= 'CDH515') or (IS_K8_ONLY.get() and cluster['status'] == 'ONLINE')]
+        } for cluster in dw_clusters if (cluster.get('status') == 'CREATED' and cluster.get('cdhVersion') >= 'CDH515') or (IS_K8S_ONLY.get() and cluster['status'] == 'ONLINE')]
       )
 
   if interface == 'oozie' or interface == 'spark2':

+ 2 - 2
desktop/core/src/desktop/conf.py

@@ -1600,8 +1600,8 @@ IS_MULTICLUSTER_ONLY = Config(
   help=_('Choose whether to pick configs only from [desktop] [[cluster]]')
 )
 
-IS_K8_ONLY = Config(
-  key='is_k8_only',
+IS_K8S_ONLY = Config(
+  key='is_k8s_only',
   default=False,
   type=coerce_bool,
   help=_('Choose whether to pick configs only from [desktop] [[cluster]]')

+ 2 - 2
desktop/core/src/desktop/models.py

@@ -49,7 +49,7 @@ from kafka.conf import has_kafka
 from notebook.conf import SHOW_NOTEBOOKS, get_ordered_interpreters
 
 from desktop import appmanager
-from desktop.conf import get_clusters, CLUSTER_ID, IS_MULTICLUSTER_ONLY, IS_EMBEDDED, IS_K8_ONLY
+from desktop.conf import get_clusters, CLUSTER_ID, IS_MULTICLUSTER_ONLY, IS_EMBEDDED, IS_K8S_ONLY
 from desktop.lib.i18n import force_unicode
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.paths import get_run_root
@@ -1919,7 +1919,7 @@ class Cluster():
 
     if len(self.clusters) == 1:
       self.data = self.clusters.values()[0]
-    elif IS_K8_ONLY.get():
+    elif IS_K8S_ONLY.get():
       self.data = self.clusters['AltusV2']
       self.data['type'] = 'altus' # To show simplified UI
     elif IS_MULTICLUSTER_ONLY.get():

+ 3 - 3
desktop/libs/metadata/src/metadata/conf.py

@@ -199,14 +199,14 @@ ALTUS = ConfigSection(
   )
 )
 
-K8 = ConfigSection(
-  key='k8',
+K8S = ConfigSection(
+  key='k8s',
   help=_t("""Configuration options for Kubernetes API"""),
   members=dict(
     API_URL=Config(
       key='api_url',
       help=_t('API URL to Kubernetes API or compatible service.'),
-      default='http://provisioner.35.236.77.238.nip.io/'),
+      default='http://provisioner.com/'),
   )
 )
 

+ 2 - 2
desktop/libs/notebook/src/notebook/connectors/altus.py

@@ -23,7 +23,7 @@ from datetime import datetime, timedelta
 from django.urls import reverse
 from django.utils.translation import ugettext as _
 
-from metadata.conf import ALTUS, K8
+from metadata.conf import ALTUS, K8S
 from navoptapi.api_lib import ApiLib
 
 
@@ -280,7 +280,7 @@ class AnalyticDbApi():
 class DataWarehouse2Api():
 
   def __init__(self, user=None):
-    self._api_url = '%s/dw' % K8.API_URL.get().rstrip('/')
+    self._api_url = '%s/dw' % K8S.API_URL.get().rstrip('/')
 
     self.user = user
     self._client = HttpClient(self._api_url, logger=LOG)