迁移工作负载

本页面介绍了如何在迁移 复制到 Assured Workloads 文件夹中。此分析比较的是 将源项目和目标 Assured Workloads 文件夹添加到 确定在启动结算流程之前或之后可能需要进行哪些更改 迁移。例如,如果你想将某个项目迁移到 已针对 FedRAMP 中风险级别配置的 Assured Workloads 文件夹,您可以 主动解决之前可能发生的任何违规行为, 移动项目。

移动分析会返回以下类型的发现结果:

  • 源项目使用了不受支持的产品或服务。
  • 源项目包含位于禁止抓取范围内的资源 位置。
  • 源项目配置了组织政策限制条件值 与目标 Assured Workloads 文件夹不兼容的工作负载。

在尝试迁移之前,请务必先发现这些问题。默认情况下 Assured Workloads 文件夹只能包含 文件夹的控制包如果您的项目包含 则您可能需要 来重新部署或移除这些资源

尽管您可以更改默认支持的服务列表, (通过将其 资源使用限制组织政策 —从而允许在您的文件夹中部署不合规的服务— 不合规的服务及其资源将被后台忽略 合规性检查。因此,启用不受支持的服务 选择承担可能导致工作负载 合规性。

准备工作

  • 收集源项目和目标“受保障的工作负载”文件夹的资源 ID。
  • 分配或验证 IAM 权限(针对 源项目和目标 Assured Workloads 文件夹 确保调用方有权执行迁移。

必需的 IAM 权限

如需执行迁移分析,必须为调用方授予 IAM 使用 预定义角色(其中包含 一组更广泛的权限,或者 自定义角色,该角色只能 所需的最低权限。

必须拥有以下权限:

  • 目的地的 assuredworkloads.workload.get 工作负载
  • 针对源项目的 cloudasset.assets.searchAllResources 权限
  • 针对源项目和目标的 orgpolicy.policy.get 权限 Assured Workloads 文件夹

执行迁移分析

对源项目和目标执行分析时 Assured Workloads 文件夹下,您应先处理所有发现结果,然后再进行迁移 从项目复制到目标位置尽管这些调查结果不会阻止您 则可能会导致目标位置发生违规行为 Assured Workloads 文件夹。

这些发现结果分为两种不同的类型:

  • 警告:当源项目可能存在 与目标平台不兼容,并且可能会导致违规。 应对警告展开调查,以验证不兼容问题是否存在 可以接受或应在迁移前解决。
  • 拦截器:检测到违规情况时,便会触发拦截器结果 源项目与目标之间的项目。必须解决障碍 然后再继续进行迁移。

系统会报告以下类型的发现结果:

  • 资源位置:许多控制包会强制执行位置限制 让资源遵守合规性要求,例如您的来源 项目包含位于禁止位置的资源。

    要解决此问题,请将受影响的资源移至允许的位置, 请删除,或者修改目标的“gcp.resourceLocations”组织 政策限制条件设置。

  • 不支持的产品/服务:每个控制包都支持 Google Cloud 产品和服务的特别清单。如果您的项目使用了目标 Assured Workloads 文件夹的控制包不支持的服务,则系统会将其列为发现。

  • 组织政策限制条件:您的源项目可能已配置 组织政策限制条件的值与目标位置不同 Assured Workloads 文件夹的有效政策,或不符合政策 控制软件包此分析仅针对 与目标 Assured Workloads 相关的限制条件 文件夹的控制软件包项目的所有限制条件值都不是 。可能会出现多种结果,例如以下问题:

    • 您的项目和目标的有效政策不兼容。
    • 您的项目具有未设置的组织政策限制条件值 反之。
    • 您的项目具有未 符合目标控制包的要求。

    如果发现组织政策限制条件的拦截器,响应将 包含符合目标对照组的预期值 软件包。您可以使用这些预期值对项目进行更改 然后再执行迁移

要解决此问题,请确定需要满足哪项组织政策限制条件 修改,以及 进行必要的更改

不支持的发现结果类型

迁移分析不支持以下类型的发现结果:

  • 组织政策限制条件的资源级不兼容(其他) 高于 gcp.resourceLocations。例如,某些控制包使用全局 gcp.restrictCmekCryptoKeyProjects 约束条件或 Compute Engine 专用 compute.disableNestedVirtualization 约束条件进行配置;系统不会分析或报告源端和目标端与这些约束条件的不兼容性。
  • 可能针对特定控制包停用的服务专用功能。 例如: Cloud Monitoring 的拨测 已针对 IL4 文件夹停用 BigQuery 的远程函数 已针对 ITAR 文件夹停用;(如果源项目使用此类已停用) 功能,那么我们不会分析或报告这些不兼容问题。

分析将项目移动到 Assured Workloads 文件夹

analyzeWorkloadMove 方法可执行将源项目移动到目标 Assured Workloads 文件夹的分析。

在以下请求示例中,将以下参数替换为您自己的参数:

  • ENDPOINT_URI:Assured Workloads 服务端点 URI。 此 URI 必须是与目的地位置匹配的端点 例如 https://us-west1-assuredworkloads.googleapis.com,表示 us-west1 区域中的区域化工作负载以及 https://us-assuredworkloads.googleapis.com(用于多区域位置) 美国。
  • DESTINATION_ORGANIZATION_ID:该组织的 源项目将迁移到的目标工作负载。例如 919698201234
  • DESTINATION_LOCATION_ID:目的地的位置 工作负载例如:us-west1us。它对应于 工作负载的 data region 值。
  • DESTINATION_WORKLOAD_ID:该目的地的 ID 将迁移源项目的 Assured Workloads 文件夹。 例如:00-701ea036-7152-4780-a867-9f5
  • SOURCE_PROJECT_ID:用于指定要迁移的源项目 ID 的查询参数。例如 my-project-123
  • ASSET_TYPES:可选。一个 每条查询的资产类型 参数,用于仅按指定类型过滤发现结果。 例如:cloudresourcemanager.googleapis.com/Project
  • PAGE_SIZE:可选。结果数量的查询参数 每页返回率例如 5
  • PAGE_TOKEN:可选。用于继续分页结果的令牌的查询参数。例如 CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

HTTP 方法、网址和查询参数:

GET https://[ENDPOINT_URI]/v1/organizations/[DESTINATION_ORGANIZATION_ID]/locations/[DESTINATION_LOCATION_ID]/workloads/[DESTINATION_WORKLOAD_ID]:analyzeWorkloadMove?project=projects/SOURCE_PROJECT_ID&page_size=PAGE_SIZE&page_token=PAGE_TOKEN

例如:

GET https://us-west1-assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

您应该收到类似以下内容的 JSON 响应:

{
  "assetMoveAnalyses": [
    {
      "asset": "//orgpolicy.googleapis.com/projects/130536381852/policies/container.restrictNoncompliantDiagnosticDataAccess",
      "assetType": "orgpolicy.googleapis.com/Policy"
    },
    {
      "asset": "//compute.googleapis.com/projects/my-project-123/global/routes/default-route-9ca6e6b0ab7326f0",
      "assetType": "compute.googleapis.com/Route",
      "analysisGroups": [
        {
          "displayName": "RESOURCE_LOCATIONS",
          "analysisResult": {
            "warnings": [
              {
                "detail": "The asset's location 'global' is incompatible with the gcp.resourceLocations org policy effective at the target. In case of 'global only' assets, this may be ignored."
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//compute.googleapis.com/projects/my-project-123/regions/europe-west10/subnetworks/default",
      "assetType": "compute.googleapis.com/Subnetwork",
      "analysisGroups": [
        {
          "displayName": "RESOURCE_LOCATIONS",
          "analysisResult": {
            "blockers": [
              {
                "detail": "The asset's location 'europe-west10' is incompatible with the gcp.resourceLocations org policy effective at the target."
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/servicemanagement.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service"
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/monitoring.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service"
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/bigquerymigration.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service",
      "analysisGroups": [
        {
          "displayName": "DISALLOWED_SERVICES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "This service is not allowed by the gcp.restrictServiceUsage org policy effective at the target"
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              },
              {
                "detail": "constraints/cloudkms.allowedProtectionLevels: Source and target set different values for this policy."
              },
              {
                "detail": "constraints/container.restrictNoncompliantDiagnosticDataAccess: Source and target set different values for this policy."
              },
              {
                "detail": "constraints/gcp.restrictServiceUsage: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              },
              {
                "detail": "constraints/container.restrictNoncompliantDiagnosticDataAccess: The value applied at the source is not compliant with the target compliance program. The expected value is [true]."
              },
              {
                "detail": "constraints/container.restrictTLSVersion: The value applied at the source is not compliant with the target compliance program. The expected denied values are [TLS_VERSION_1, TLS_VERSION_1_1]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

如需按特定资产类型过滤发现结果,请使用 asset_types 查询 参数:

GET https://assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&asset_types=cloudresourcemanager.googleapis.com/Project&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

结果将仅包含指定类型的任何发现结果 (cloudresourcemanager.googleapis.com/Project):

{
  "assetMoveAnalyses": [
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

如需按多种素材资源类型过滤发现结果,请将每种素材资源类型添加为另外一种 查询参数:

GET https://assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&asset_types=cloudresourcemanager.googleapis.com/Project&asset_types=serviceusage.googleapis.com/Service&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

结果将仅包含指定类型的任何发现结果 (cloudresourcemanager.googleapis.com/Projectserviceusage.googleapis.com/Service):

{
  "assetMoveAnalyses": [
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/bigquerymigration.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service",
      "analysisGroups": [
        {
          "displayName": "DISALLOWED_SERVICES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "This service is not allowed by the gcp.restrictServiceUsage org policy effective at the target"
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

执行迁移分析后,请查看并解决 然后再次运行分析 问题。然后,您可以 迁移项目的步骤如下:

后续步骤