Kubernetes node role refactored. 47/1747/1
authorBalazs Szekeres <balazs.szekeres@nokia.com>
Tue, 8 Oct 2019 12:17:39 +0000 (14:17 +0200)
committerBalazs Szekeres <balazs.szekeres@nokia.com>
Tue, 8 Oct 2019 12:18:19 +0000 (14:18 +0200)
Change-Id: Iffa2cc30ce13a5e36817966b809e568dca7a4999
Signed-off-by: Balazs Szekeres <balazs.szekeres@nokia.com>
cmdatahandlers/src/cmdatahandlers/caas/config.py
cmdatahandlers/src/cmdatahandlers/hosts/config.py
cmframework/src/cmframework/utils/cmansibleinventory.py

index 7a2afb2..12059c2 100644 (file)
@@ -83,6 +83,7 @@ class Config(config.Config):
             self.set_caas_parameter('log_forwarding', [])
         hostsconf = self.confman.get_hosts_config_handler()
         hostsconf.set_nodeindex()
             self.set_caas_parameter('log_forwarding', [])
         hostsconf = self.confman.get_hosts_config_handler()
         hostsconf.set_nodeindex()
+        hostsconf.set_noderole()
 
     def set_static_config(self):
         try:
 
     def set_static_config(self):
         try:
index 6f3deb8..df31dc1 100644 (file)
@@ -194,6 +194,11 @@ class Config(config.Config):
 
         return service_profiles[0]
 
 
         return service_profiles[0]
 
+    def set_noderole(self):
+        hosts = self.get_hosts()
+        for host in hosts:
+            self.config[self.ROOT][host]['noderole'] = self.get_noderole(host)
+
     def set_nodeindex(self):
         hostsconf = self.confman.get_hosts_config_handler()
         install_host = utils.get_installation_host_name(hostsconf)
     def set_nodeindex(self):
         hostsconf = self.confman.get_hosts_config_handler()
         install_host = utils.get_installation_host_name(hostsconf)
index a940f78..bf2e66f 100644 (file)
@@ -79,11 +79,6 @@ class AnsibleInventory(object):
         hostvars[node]['nodetype'] = hostsconf.get_nodetype(node)
         hostvars[node]['nodeindex'] = hostsconf.get_nodeindex(node)
         hostvars[node]['nodename'] = hostsconf.get_nodename(node)
         hostvars[node]['nodetype'] = hostsconf.get_nodetype(node)
         hostvars[node]['nodeindex'] = hostsconf.get_nodeindex(node)
         hostvars[node]['nodename'] = hostsconf.get_nodename(node)
-        if hostsconf.get_nodetype(node) == "caas-master":
-            hostvars[node]['noderole'] = "master"
-        elif hostsconf.get_nodetype(node) == "caas-worker":
-            hostvars[node]['noderole'] = "worker"
-
         host_labels = hostsconf.get_labels(node)
         if host_labels:
             hostvars[node]['labels'] = host_labels
         host_labels = hostsconf.get_labels(node)
         if host_labels:
             hostvars[node]['labels'] = host_labels