gpt4 book ai didi

google-cloud-platform - Deployment Manager 是否支持云功能(并支持拥有多个云功能)?

转载 作者:行者123 更新时间:2023-12-04 16:42:11 25 4
gpt4 key购买 nike

我看着这个 repo,对这里发生的事情感到非常困惑:https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/cloud_functions

在其他部署管理器示例中,我看到“类型”设置为正在部署的资源类型,但在本示例中,我看到了这一点:

resources:
- name: function
type: cloud_function.py # why not "type: cloudfunctions"?
properties:
# All the files that start with this prefix will be packed in the Cloud Function
codeLocation: function/
codeBucket: mybucket
codeBucketObject: function.zip
location: us-central1
timeout: 60s
runtime: nodejs8
availableMemoryMb: 256
entryPoint: handler

“类型”指向一个 python 脚本 (cloud_function.py) 而不是资源类型。该脚本长达 100 多行,并且做了一大堆东西。

这看起来像是一个 hack,就像它只是编写 GCP API 的脚本一样?我想要使​​用部署管理器之类的东西的原因是为了避免部署脚本的困惑,但这看起来更像是意大利面

部署管理器是否不支持云功能,这是一个hacky 解决方法还是它应该如何工作?这个例子的文档很糟糕所以我不知道发生了什么

此外,我想将多个功能部署到单个部署管理器堆栈中 - 必须编辑 cloud_function.py脚本还是我可以定义多个资源并让它们都指向同一个脚本?

编辑 我也对这两个导入在 cloud_function.yaml 顶部的用途感到困惑:
imports:
# The function code will be defined for the files in function/
- path: function/index.js
- path: function/package.json

为什么要导入其部署的函数的实际代码?

最佳答案

部署管理器只是与不同类型的 Google API 交互。此 documentation为您提供部署管理器支持的资源类型列表。我建议你运行这个命令“gcloud deployment-manager types list | grep function”,你会发现DM也支持这种“cloudfunctions.v1beta2.function”资源类型。

该模板正在使用 gcp-type (即处于测试阶段)。 cloud_functions.py 是 template .如果你使用一个模板,你可以为多个资源重用它,你可以看到example .为了更好地理解,更容易阅读/遵循,您可以查看此 example通过 gcp 类型的云功能。

关于google-cloud-platform - Deployment Manager 是否支持云功能(并支持拥有多个云功能)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58294827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com