kubernetes - Argo CD 通知出现错误 'failed to execute when condition: cannot fetch phase from <nil>'

标签 kubernetes argocd

我已经安装了全新的 Argo CD (v2.1.7) 和通知 (v1.2.0)。我将其配置为向我发送一条 Slack 消息,并使用以下注释将我的应用程序订阅到 on-deployed 触发器:

annotations:
  notifications.argoproj.io/subscribe.on-deployed.slack: my_channel

当我部署应用程序时,argocd-notifications-controller 的日志输出为:

time="2021-12-10T12:18:23Z" level=error msg="failed to execute oncePer condition: cannot fetch syncResult from <nil> (1:27)\n | app.status.operationState.syncResult.revision\n | ..........................^"
time="2021-12-10T12:18:23Z" level=info msg="Trigger on-deployed result: [{[0].y7b5sbwa2Q329JYH755peeq-fBs  [app-deployed] false}]" resource=argocd/ah-ctp-argocd-test
time="2021-12-10T12:18:23Z" level=info msg="Processing completed" resource=argocd/ah-ctp-argocd-test
time="2021-12-10T12:19:21Z" level=info msg="Start processing" resource=argocd/ah-ctp-argocd-test
time="2021-12-10T12:19:21Z" level=error msg="failed to execute when condition: cannot fetch phase from <nil> (1:27)\n | app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'\n | ..........................^"

作为测试,我将 when 条件更改为 when: true 并将 {{ .app }} 添加到消息正文,然后重新部署。我在 Slack 中收到了通知,但是 {{ .app }} 不包含 operationState。例如,它确实包含 app.status.health.status 并且其值为“Healthy”。

我看到没有人在网上发布任何类似的错误,这让我觉得我一定做错了什么。有人有什么建议吗?

最佳答案

好的,这是一个 PEDKAC 错误。我第一次收到通知,但之后就再也没有收到过。事实证明,Argo CD 会跟踪它已发送通知的提交。问题是我正在删除并重新部署 Argo CD 中的应用程序,但它始终是相同的提交。当我创建一个新的提交并从中进行部署时,通知按预期发出。

关于kubernetes - Argo CD 通知出现错误 'failed to execute when condition: cannot fetch phase from <nil>',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70304476/

相关文章:

dns - Kubernetes 设置的 Gitlab DNS 条目?

docker - 将vm附加到kubernetes节点列表

kubernetes - 子字符串匹配条件时的 Argo 工作流程

argoproj - 我在哪里可以获得 ArgoCD api 的深入文档

windows - 如何将容器推送到 Google Container Registry(无法创建存储库)

kubernetes - 禁用创建和使用API​​凭证

kubernetes - 尽管提供了 dockerconfigjson,ArgoCD 仍无法提取图像

kubernetes - 应用程序之间的 ArgoCD 同步波

azure - 如何在 ArgoCD 中使用 AKS 托管身份连接到 ACR?

linux - Packer、Dockramp 与 Dockerfile