From: 刘洪青 Date: Mon, 12 Oct 2020 16:25:42 +0000 (+0800) Subject: feat: authx-service 的 poa api-docs 的初始化工具,支持 POA_SA 服务地址的可配置 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=b42034e747a0cd48c1885da55cf63884550dda46;p=institute%2Fdeploy-authx-service.git feat: authx-service 的 poa api-docs 的初始化工具,支持 POA_SA 服务地址的可配置 --- diff --git a/deploy-manifests/k8s-rancher/1.authx-service/0.authx-service/9.poa-api-docs-installer.yaml b/deploy-manifests/k8s-rancher/1.authx-service/0.authx-service/9.poa-api-docs-installer.yaml index 2b5d006..41fa706 100644 --- a/deploy-manifests/k8s-rancher/1.authx-service/0.authx-service/9.poa-api-docs-installer.yaml +++ b/deploy-manifests/k8s-rancher/1.authx-service/0.authx-service/9.poa-api-docs-installer.yaml @@ -11,6 +11,7 @@ data: # 平台OpenAPI的外网访问地址, # **修改** 学校的根域名 POA_SERVER_URL: http://poa.paas.xxx.edu.cn + POA_SA_SERVER_URL: http://poa-sa-svc.poa.svc.cluster.local:8443 --- diff --git a/poa-api-docs/docker-entrypoint.sh b/poa-api-docs/docker-entrypoint.sh index 31b34bc..3381313 100644 --- a/poa-api-docs/docker-entrypoint.sh +++ b/poa-api-docs/docker-entrypoint.sh @@ -16,6 +16,10 @@ if [ "$1" = 'app' ]; then replace_file "/root/poa-api-docs/communicate-center-poa.v1.yaml" "POA_SERVER_URL" "$POA_SERVER_URL" fi + # if [ -n "$POA_SA_SERVER_URL" ]; then + # replace_file "/root/poa-api-docs/exec.sh" "POA_SA_SERVER_URL" "$POA_SA_SERVER_URL" + # fi + set -ex; exec /root/poa-api-docs/exec.sh else diff --git a/poa-api-docs/exec.sh b/poa-api-docs/exec.sh index 6ea097d..bfe4bc6 100644 --- a/poa-api-docs/exec.sh +++ b/poa-api-docs/exec.sh @@ -4,52 +4,59 @@ cd /root/poa-api-docs ls -al +if [ -z "$POA_SA_SERVER_URL" ]; then + POA_SA_SERVER_URL="http://poa-sa-svc.poa.svc.cluster.local:8443" +fi + +echo "POA_SA_SERVER_URL2=${POA_SA_SERVER_URL}" + + # user-data-service-poa.v1.yaml -curl -i -s -X DELETE 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/user' +curl -i -s -X DELETE "${POA_SA_SERVER_URL}/v1/services/user" # 1. 创建服务 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services' -H 'Content-Type: application/json' -d '{"id": "user", "origin": "http://user-data-service-poa-svc.user-data-service.svc.cluster.local:8080", "name": "用户服务", "description": "用户服务"}' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services" -H 'Content-Type: application/json' -d '{"id": "user", "origin": "http://user-data-service-poa-svc.user-data-service.svc.cluster.local:8080", "name": "用户服务", "description": "用户服务"}' # 2. 创建版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/user/apiVersions/v1' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/user/apiVersions/v1" # 3. 上传OAS Yaml -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/user/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @user-data-service-poa.v1.yaml +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/user/apiVersions/v1/apiSpecs" -H 'Content-Type: application/yaml' --data-binary @user-data-service-poa.v1.yaml # 4. 发布版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/user/apiVersions/v1/publish' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/user/apiVersions/v1/publish" # user-authorization-service-poa.v1.yaml -curl -i -s -X DELETE 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/authz' +curl -i -s -X DELETE "${POA_SA_SERVER_URL}/v1/services/authz" # 1. 创建服务 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services' -H 'Content-Type: application/json' -d '{"id": "authz", "origin": "http://user-authorization-poa-svc.user-authorization-service.svc.cluster.local:8080", "name": "授权服务", "description": "授权服务"}' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services' -H 'Content-Type: application/json" -d '{"id": "authz", "origin": "http://user-authorization-poa-svc.user-authorization-service.svc.cluster.local:8080", "name": "授权服务", "description": "授权服务"}' # 2. 创建版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/authz/apiVersions/v1' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/authz/apiVersions/v1" # 3. 上传OAS Yaml -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/authz/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @user-authorization-service-poa.v1.yaml +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/authz/apiVersions/v1/apiSpecs" -H 'Content-Type: application/yaml' --data-binary @user-authorization-service-poa.v1.yaml # 4. 发布版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/authz/apiVersions/v1/publish' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/authz/apiVersions/v1/publish" # communicate-center-poa.v1.yaml -curl -i -s -X DELETE 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/communicate' +curl -i -s -X DELETE "${POA_SA_SERVER_URL}/v1/services/communicate" # 1. 创建服务 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services' -H 'Content-Type: application/json' -d '{"id": "communicate", "origin": "http://communicate-center-poa-svc.communicate-center.svc.cluster.local:8080", "name": "通信服务", "description": "通信服务"}' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services' -H 'Content-Type: application/json" -d '{"id": "communicate", "origin": "http://communicate-center-poa-svc.communicate-center.svc.cluster.local:8080", "name": "通信服务", "description": "通信服务"}' # 2. 创建版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/communicate/apiVersions/v1' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/communicate/apiVersions/v1" # 3. 上传OAS Yaml -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/communicate/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @communicate-center-poa.v1.yaml +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/communicate/apiVersions/v1/apiSpecs" -H 'Content-Type: application/yaml' --data-binary @communicate-center-poa.v1.yaml # 4. 发布版本 -curl -i -s -X POST 'http://poa-sa-svc.poa.svc.cluster.local:8443/v1/services/communicate/apiVersions/v1/publish' +curl -i -s -X POST "${POA_SA_SERVER_URL}/v1/services/communicate/apiVersions/v1/publish"