mirror of
https://github.com/tencentmusic/cube-studio.git
synced 2024-11-27 05:33:10 +08:00
fix service proxy ip
This commit is contained in:
parent
ae39198ed7
commit
94139c4aa6
@ -901,8 +901,10 @@ output %s
|
||||
# 使用项目组ip
|
||||
if service.project.expand:
|
||||
ip = json.loads(service.project.expand).get('SERVICE_EXTERNAL_IP', '')
|
||||
if ip and type(SERVICE_EXTERNAL_IP)==str:
|
||||
if ip and type(ip) == str:
|
||||
SERVICE_EXTERNAL_IP = [ip]
|
||||
if ip and type(ip) == list:
|
||||
SERVICE_EXTERNAL_IP = ip
|
||||
|
||||
# 使用全局ip
|
||||
if not SERVICE_EXTERNAL_IP:
|
||||
|
@ -70,7 +70,7 @@ class Service_ModelView_base():
|
||||
"project": [["name", Project_Join_Filter, 'org']]
|
||||
}
|
||||
edit_form_query_rel_fields = add_form_query_rel_fields
|
||||
|
||||
host_rule = ",".join([cluster + "集群:*." + conf.get('CLUSTERS')[cluster].get("SERVICE_DOMAIN", '') for cluster in conf.get('CLUSTERS') if conf.get('CLUSTERS')[cluster].get("SERVICE_DOMAIN", '')])
|
||||
add_form_extra_fields={
|
||||
"project": QuerySelectField(
|
||||
_(datamodel.obj.lab('project')),
|
||||
@ -90,9 +90,7 @@ class Service_ModelView_base():
|
||||
"replicas": StringField(_(datamodel.obj.lab('replicas')), default=Service.replicas.default.arg,description='pod副本数,用来配置高可用',widget=BS3TextFieldWidget(), validators=[DataRequired()]),
|
||||
"ports": StringField(_(datamodel.obj.lab('ports')), default=Service.ports.default.arg,description='进程端口号,逗号分隔',widget=BS3TextFieldWidget(), validators=[DataRequired()]),
|
||||
"env": StringField(_(datamodel.obj.lab('env')), default=Service.env.default.arg, description='使用模板的task自动添加的环境变量,支持模板变量。书写格式:每行一个环境变量env_key=env_value',widget=MyBS3TextAreaFieldWidget()),
|
||||
"host": StringField(_(datamodel.obj.lab('host')), default=Service.host.default.arg,
|
||||
description='访问域名,http://xx.service.%s'%conf.get('ISTIO_INGRESS_DOMAIN',''),
|
||||
widget=BS3TextFieldWidget()),
|
||||
"host": StringField(_(datamodel.obj.lab('host')), default=Service.host.default.arg,description='访问域名,' + host_rule, widget=BS3TextFieldWidget()),
|
||||
}
|
||||
|
||||
gpu_type = conf.get('GPU_TYPE')
|
||||
@ -192,7 +190,7 @@ class Service_ModelView_base():
|
||||
selector=labels
|
||||
)
|
||||
# 如果域名配置的gateway,就用这个
|
||||
host = service.name+"."+conf.get('SERVICE_DOMAIN')
|
||||
host = service.name+"."+service.project.cluster.get('SERVICE_DOMAIN','')
|
||||
if service.host:
|
||||
host=service.host.replace('http://','').replace('https://','').strip()
|
||||
if "/" in host:
|
||||
@ -212,8 +210,10 @@ class Service_ModelView_base():
|
||||
# 使用项目组ip
|
||||
if service.project.expand:
|
||||
ip = json.loads(service.project.expand).get('SERVICE_EXTERNAL_IP', '')
|
||||
if ip and type(SERVICE_EXTERNAL_IP)==str:
|
||||
if ip and type(ip)==str:
|
||||
SERVICE_EXTERNAL_IP = [ip]
|
||||
if ip and type(ip)==list:
|
||||
SERVICE_EXTERNAL_IP=ip
|
||||
|
||||
# 使用全局ip
|
||||
if not SERVICE_EXTERNAL_IP:
|
||||
|
@ -262,7 +262,7 @@ class Project_ModelView_org_Api(Project_ModelView_Base,MyappModelRestApi):
|
||||
),
|
||||
'expand': StringField(
|
||||
_(datamodel.obj.lab('expand')),
|
||||
description='扩展参数。示例参数:<br>"cluster": "dev"<br>"node_selector": "org=public"<br>"volume_mount": "kubeflow-user-workspace(pvc):/mnt/;/data/k8s/../group1(hostpath):/mnt1;4G(memory):/dev/shm"<br>"SERVICE_EXTERNAL_IP":"xx.xx.xx.xx"',
|
||||
description='扩展参数。示例参数:<br>"cluster": "dev"<br>"node_selector": "org=public"<br>"volume_mount": "kubeflow-user-workspace(pvc):/mnt/;/data/k8s/../group1(hostpath):/mnt1"<br>"SERVICE_EXTERNAL_IP":"xx.xx.xx.xx"',
|
||||
widget=MyBS3TextAreaFieldWidget(),
|
||||
default=json.dumps({"cluster": "dev"},indent=4,ensure_ascii=False),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user