|
@@ -10,6 +10,11 @@ from kubernetes.client.rest import ApiException
|
|
|
from pprint import pprint
|
|
|
from kubernetes import client, config
|
|
|
import sys, getopt, random
|
|
|
+from aliyunsdkcore.client import AcsClient
|
|
|
+from aliyunsdkcore.acs_exception.exceptions import ClientException
|
|
|
+from aliyunsdkcore.acs_exception.exceptions import ServerException
|
|
|
+from aliyunsdkalidns.request.v20150109.AddDomainRecordRequest import AddDomainRecordRequest
|
|
|
+from aliyunsdkalidns.request.v20150109.DeleteDomainRecordRequest import DeleteDomainRecordRequest
|
|
|
|
|
|
|
|
|
JNLP_ENV = os.getenv('JNLP_ENV')
|
|
@@ -123,7 +128,7 @@ def deployStatus():
|
|
|
stsname = JNLP_CONTROL_NAME
|
|
|
pretty = "true"
|
|
|
for x in range(20):
|
|
|
- try:
|
|
|
+ try:
|
|
|
sts_response = appsv1_api_instance.read_namespaced_stateful_set_status(stsname, namespace, pretty=pretty)
|
|
|
if sts_response.status.replicas == sts_response.status.ready_replicas :
|
|
|
print("===>>> " +stsname + " is RUNNING <<<===")
|
|
@@ -168,6 +173,21 @@ def dnsAllocation():
|
|
|
print(">>> Ingress error, Only nginx !!! <<<")
|
|
|
return
|
|
|
|
|
|
+def cloudDns():
|
|
|
+ if JNLP_INGRESS == "nginx":
|
|
|
+ client = AcsClient('LTAI4LibOCW5ilIa', 'NiA9OumXJDHp4TwLwXWcCKGoDgDjms', 'cn-hangzhou')
|
|
|
+ # add record
|
|
|
+ request = AddDomainRecordRequest()
|
|
|
+ request.set_accept_format('json')
|
|
|
+ request.set_Value("scofield888888")
|
|
|
+ request.set_Type("txt")
|
|
|
+ request.set_RR("_dnsauth.8888")
|
|
|
+ request.set_DomainName("appeasou.com")
|
|
|
+ response = client.do_action_with_exception(request)
|
|
|
+ print(response)
|
|
|
+ else :
|
|
|
+ print(">>> Ingress error, Only nginx !!! <<<")
|
|
|
+ return
|
|
|
|
|
|
def main(argv=None):
|
|
|
if argv is None:
|
|
@@ -188,7 +208,7 @@ def main(argv=None):
|
|
|
sys.exit()
|
|
|
if opt_name in ('-d','--dns'):
|
|
|
print("===>>> update dns resolve <<<===")
|
|
|
- dnsAllocation()
|
|
|
+ cloudDns()
|
|
|
sys.exit()
|
|
|
return
|
|
|
|