【问题标题】:Can't set-traffic - gcloud无法设置流量 - gcloud
【发布时间】:2016-09-29 15:28:03
【问题描述】:

所以,

我更新了 gcloud 组件。我一直在使用以下内容,但现在失败了:

gcloud app modules set-default default --version my-version --project my-proj

所以我尝试了:

gcloud app services set-traffic --project my-proj --splits my-version=1 --migrate

但我得到以下输出:

Setting the following traffic allocations:
 - my-proj/default/my-version: 1.0
Any other versions on the specified services will receive zero traffic.
ERROR: (gcloud.app.services.set-traffic) Issue setting traffic on service(s): default

INVALID_ARGUMENT: Invalid request.

有什么想法会出错吗?

提前致谢, 呵呵

========== 编辑 ============

按照 Newman 的建议,详细程度如下:

DEBUG: Running gcloud.app.services.set-traffic with Namespace(__calliope_internal_deepest_parser=ArgumentParser(prog='gcloud.app.services.set-traffic', usage=None, description='This command sets the traffic split of versions across a service or a project.', version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=False), account=None, authority_selector=None, authorization_token_file=None, calliope_command=<googlecloudsdk.calliope.backend.Command object at 0x101309bd0>, command_path=['gcloud', 'app', 'services', 'set-traffic'], configuration=None, credential_file_override=None, document=None, flatten=None, format=None, h=None, help=None, http_timeout=None, log_http='true', migrate=True, project='my-proj', quiet=True, services=[], split_by='ip', splits={'my-version': '1'}, trace_email=None, trace_log=None, trace_token=None, user_output_enabled=None, verbosity='debug', version=None).
--request-start--
uri: https://appengine.googleapis.com/v1beta5/apps/my-proj/services?alt=json
method: GET
-headers-start-
Authorization: Bearer {something that looks like a secret}
accept: application/json
accept-encoding: gzip, deflate
content-length: 0
user-agent: Cloud SDK Command Line Tool {something that looks like a secret} gcloud/128.0.0 command/gcloud.app.services.set-traffic invocation-id/{something that looks like a secret} environment/None environment-version/None interactive/True python/2.7.10 (Macintosh; Intel Mac OS X 15.6.0)
-headers-end-
-body-start-

-body-end-
--request-end--
--response-start--
-headers-start-
-content-encoding: gzip
alt-svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
cache-control: private
content-length: 189
content-location: https://appengine.googleapis.com/v1beta5/apps/my-proj/services?alt=json
content-type: application/json; charset=UTF-8
date: Wed, 05 Oct 2016 13:45:30 GMT
server: ESF
status: 200
transfer-encoding: chunked
vary: Origin, X-Origin, Referer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
-headers-end-
-body-start-
{
  "services": [
    {
      "name": "apps/my-proj/services/default",
      "id": "default",
      "split": {
        "allocations": {
          "test": 1
        }
      }
    }
  ]
}

-body-end-
total latency (request+response): 1.773 secs
--response-end--
Setting the following traffic allocations:
 - my-proj/default/my-version: 1.0
Any other versions on the specified services will receive zero traffic.
--request-start--
uri: https://appengine.googleapis.com/v1beta5/apps/my-proj/services/default?mask=split&alt=json&migrateTraffic=True
method: PATCH
-headers-start-
Authorization: Bearer {something that looks like a secret}
accept: application/json
accept-encoding: gzip, deflate
content-length: 61
content-type: application/json
user-agent: Cloud SDK Command Line Tool {something that looks like a secret} gcloud/128.0.0 command/gcloud.app.services.set-traffic invocation-id/{something that looks like a secret} environment/None environment-version/None interactive/True python/2.7.10 (Macintosh; Intel Mac OS X 15.6.0)
-headers-end-
-body-start-
{"split": {"allocations": {"my-version": 1.0}, "shardBy": "IP"}}
-body-end-
--request-end--
--response-start--
-headers-start-
-content-encoding: gzip
alt-svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
cache-control: private
content-length: 549
content-type: application/json; charset=UTF-8
date: Wed, 05 Oct 2016 13:45:31 GMT
server: ESF
status: 400
transfer-encoding: chunked
vary: Origin, X-Origin, Referer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
-headers-end-
-body-start-
{
  "error": {
    "code": 400,
    "message": "Invalid request.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "service",
            "description": "Traffic migration does not support Managed VMs."
          },
          {
            "field": "service.split.allocations[my-version]",
            "description": "Warmup requests are not enabled for the target version."
          }
        ]
      }
    ]
  }
}

-body-end-
total latency (request+response): 0.981 secs
--response-end--
DEBUG: (gcloud.app.services.set-traffic) Issue setting traffic on service(s): default

INVALID_ARGUMENT: Invalid request.
Traceback (most recent call last):
  File "/Users/ohad/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 733, in Execute
    resources = args.calliope_command.Run(cli=self, args=args)
  File "/Users/ohad/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 1630, in Run
    resources = command_instance.Run(args)
  File "/Users/ohad/google-cloud-sdk/lib/surface/app/services/set_traffic.py", line 134, in Run
    '\n\n'.join(printable_errors.values()))
TrafficSplitError: Issue setting traffic on service(s): default

INVALID_ARGUMENT: Invalid request.
ERROR: (gcloud.app.services.set-traffic) Issue setting traffic on service(s): default

INVALID_ARGUMENT: Invalid request.

【问题讨论】:

  • 您介意再次使用--log-http--verbosity=debug 运行并共享输出(确保撕掉例如您的访问令牌和任何个人信息)吗?
  • @Newman,感谢您的建议。我已经编辑了帖子以包含输出。根据给出的数据,很明显我的设置不支持 {{--migrate}}。我已经解决了。
  • 是的。弹性环境(env: flex)不支持流量迁移。删除--migrate 后是否成功?

标签: gcloud


【解决方案1】:

您是否正在尝试将流量迁移到您的 gcp app engine 的新版本?

gclouddocumentation

此命令将立即将流量迁移到指定的版本:

gcloud app services set-traffic MY_SERVICE --splits MY_VERSION=1

或者您可以按百分比(verion1=30%version2=70%)拆分:

gcloud app services set-traffic MY_SERVICE --splits MY_VERSION_V1=0.3,MY_VERSION_V2=0.7

【讨论】:

  • 有趣,即使我通过 GUI 进入时无法切换流量,这也很有效。
【解决方案2】:

引用GAE documentation

不支持在柔性环境中运行的版本之间的渐进式流量迁移流量。您必须立即将流量迁移到在柔性环境中运行的版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-09
    • 2023-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多