无法设置流量 - gcloud

时间:2016-09-29 15:28:03

标签: gcloud

所以,

我已经更新了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.

任何可能出错的想法?​​

提前致谢, 辖

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

如同纽曼所建议的那样冗长,这就是输出:

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.

2 个答案:

答案 0 :(得分:0)

引用GAE documentation

  

不支持在灵活环境中运行的版本之间进行逐步的流量迁移。您必须立即将流量迁移到在灵活环境中运行的版本。

答案 1 :(得分:0)

您是否要将流量迁移到gcp app engine的新版本?

gcloud documentation

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

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