dm/python/test.py

31 lines
935 B
Python
Raw Normal View History

2024-07-03 14:08:43 +08:00
import json
import dmPython
import k8s_func
db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
cursor=db.cursor()
studentList=['20240101','20240102']
testID='5'
type1=2
for i in studentList:
if type1==1:
name='s'+i+'-'+testID
# k8s_func.create_pod(type1,name)
item=k8s_func.list_services()
for j in item['list']:
if j['name']==name+'-service':
Link = 'http://36.138.114.105/' + str(j['ports'][0]['node_port'])
Link2 = 'http://36.138.114.105/' + str(j['ports'][1]['node_port'])
Link3 = 'http://36.138.114.105/' + str(j['ports'][2]['node_port'])
else:
name='n'+i+'-'+testID
# k8s_func.create_pod(0,name)
item=k8s_func.list_services()
for j in item['list']:
if j['name']==name+'-service':
Link=j['ip']
print(Link)