Add a parameter to control whether the add node function is enabled.

This commit is contained in:
zhongyehong 2018-05-20 17:32:35 +08:00
parent 490a9901ac
commit b40fad7acc
3 changed files with 15 additions and 1 deletions

View File

@ -178,3 +178,7 @@
# The two ports next to '-' are inclueded. If there are several ranges,
# Please seperate them by ',' , for example: 10000-20000,30000-40000
# ALLOCATED_PORTS=10000-65535
# ALLOW_SCALE_OUT: allow docklet to rent server on the cloud to scale out
# Only when you deploy docklet on the cloud can you set it to True
# ALLOW_SCALE_OUT=False

View File

@ -162,6 +162,11 @@ class AliyunMgr():
thread.setDaemon(True)
thread.start()
class EmptyMgr():
def addNodeAsync(self):
logger.error("current cluster does not support scale out")
return False
class CloudMgr():
def getSettingFile(self):
@ -185,4 +190,7 @@ class CloudMgr():
def __init__(self):
self.engine = AliyunMgr()
if env.getenv("ALLOW_SCALE_OUT") == "True":
self.engine = AliyunMgr()
else:
self.engine = EmptyMgr()

View File

@ -77,5 +77,7 @@ def getenv(key):
return os.environ.get("APPROVAL_RBT","ON")
elif key =="ALLOCATED_PORTS":
return os.environ.get("ALLOCATED_PORTS","10000-65535")
elif key =="ALLOW_SCALE_OUT":
return os.environ.get("ALLOW_SCALE_OUT", "False")
else:
return os.environ.get(key,"")