You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为多环境配置ArgoCD Rollout?仅生产环境启用蓝绿部署

需求与问题

我的持续部署(CI/CD)流水线遵循标准化原则,当前在dev、test、staging、production所有环境中的执行逻辑完全一致。

我希望仅在production环境中实现blue/green部署,但不想为不同环境拆分Helm模板(例如生产环境用rollout.yaml,其他环境用deployment.yaml),因此需要一个更优的解决方案。

我目前的思路(但不满意)

参考Argo Rollouts的示例写法,在模板中通过Values动态传入部署策略:

spec:
  replicas: {{ .Values.replicaCount }}
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: {{ template "helm-guestbook.name" . }}
      release: {{ .Release.Name }}
  strategy:
    {{ tpl toYaml .Values.rolloutStrategy . | indent 12 }}
  template:
    metadata:

在dev、test、staging环境的values文件(如values-dev.yaml)中配置空的策略:

rolloutStrategy:

在production环境的values-prod.yaml中配置blue/green策略:

rolloutStrategy: 
  blueGreen:
    activeService: {{ template "helm-guestbook.fullname" . }}
    previewService: {{ template "helm-guestbook.fullname" . }}-preview

但我并不喜欢这个方案,请问是否有更好的解决办法?


内容的提问来源于stack exchange,提问作者posthumecaver

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 16:55:08