简体   繁体   English

GCP Cloud Function 未安装来自 Secret Manager 的最新机密

[英]GCP Cloud Function not mounting latest secret from Secret Manager

My Cloud Function is referencing an older version of a secret that is mounted, despite using the :latest suffix尽管使用了:latest后缀,My Cloud Function 正在引用已安装的旧版本的秘密

I have a Cloud Function deployed that mounts a secret when I deploy, explicitly referencing the latest version of the secret:我部署了一个云 Function,它在我部署时安装了一个秘密,明确引用了秘密的最新版本:

--set-secrets=DATABASE_URL=projects/MY_PROJECT/secrets/DATABASE_URL:latest

I see this is set up correctly in my Cloud Function console but when running the function it is referencing a past version of the secret.我看到这在我的云 Function 控制台中设置正确,但在运行 function 时它引用了过去版本的秘密。 I am logging the secret to test with process.env.DATABASE_URL (it is a Node runtime).我正在记录秘密以使用process.env.DATABASE_URL (它是一个 Node 运行时)进行测试。

If I redeploy the function this is fixed.如果我重新部署 function,这是固定的。 I'm confused because the docs specify that mounting the secrets and adding the :latest suffix will use the most recent version when the function runs.我很困惑,因为文档指定安装机密并添加:latest后缀将在 function 运行时使用最新版本。

The secret is resolved when this instance of the Cloud Function starts.当云 Function 的这个实例启动时,秘密就解决了。 If the function stays active without going to sleep it will keep the old version of the secret mounted asn an environment variable.如果 function 保持活动状态而不会休眠,它会将旧版本的秘密安装为环境变量。 If you mount the secret as a volume and read the file it will automatically update.如果您将机密作为卷安装并读取文件,它将自动更新。

Credit: John Hanley's comment图片来源:John Hanley 的评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 terraform 中从 GCP 秘密管理器读取秘密 - How to read a secret from GCP secret manager in terraform 无法将 GCP 秘密管理器与 GCP 云功能(nodeJS)一起使用 - not able to use GCP secret-manager with GCP cloud functions(nodeJS) 使用 spring 引导从 Secret Manager GCP 获取值 - get values from Secret Manager GCP with spring boot 无法从独立的 go 应用程序访问 gcp 秘密管理器 - Not able to access gcp secret manager from standalone go application 从 GCP 秘密管理器读取.DER 值并将其保存到.DER 文件 - Read .DER value from GCP secret manager and save it to .DER file 如何从 lambda function 呼叫 Secret Manager - How to call secret manager from lambda function 无法从 Google Cloud 访问存储在 Secrets Manager 中的机密 Function - Can't access secret stored in Secrets Manager from Google Cloud Function 在 Java 的集成测试中使用 GCP Secret Manager - Using GCP Secret Manager in integration tests in Java AWS Secret Manager 秘密检索到云前端模板 YAML - AWS Secret Manager secret retrieval to Cloud front template YAML 云数据融合 - Secret Manager 集成 - Cloud Data Fusion - Secret Manager integration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM