如何使用ArgoCD管理依赖关系



使用ArgoCD部署时,如何管理pod的依赖关系?

我为什么需要这个

我想确保,在部署pod B之前,第一个pod A已经部署并成功运行。

Flux提供了这样一个工作负载依赖特性。但我看不到ArgoCD有这样的功能。

您可以使用同步波按给定顺序部署pod。

示例

apiVersion: apps/v1
kind: Deployment
metadata:
name: podA
annotations:
argocd.argoproj.io/sync-wave: "1"
...
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podB
annotations:
argocd.argoproj.io/sync-wave: "2"
...

更新:不同应用程序的波形

如果你想为不同的应用程序提供波形,那么你需要修补ArgoCD配置:https://codefresh.io/blog/argo-cd-application-dependencies/

$ cat patch-argocd-cm.yaml
data:
resource.customizations.health.argoproj.io_Application: |
hs = {}
hs.status = "Progressing"
hs.message = ""
if obj.status ~= nil then
if obj.status.health ~= nil then
hs.status = obj.status.health.status
if obj.status.health.message ~= nil then
hs.message = obj.status.health.message
end
end
end
return hs
$ kubectl patch cm/argocd-cm --type=merge -n argocd --patch-file patch-argocd-cm.yaml

文档https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/

最新更新