[英]In a Helm Chart, how can I block the upgrade until a deployment in it is complete?
I am using Rancher Pipelines and catalogs to run Helm Charts like this:我正在使用 Rancher Pipelines 和目录来运行 Helm Charts,如下所示:
.rancher-pipeline.yml
stages:
- name: Deploy app-web
steps:
- applyAppConfig:
catalogTemplate: cattle-global-data:chart-web-server
version: 0.4.0
name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-serv
targetNamespace: ${CICD_GIT_REPO_NAME}
answers:
pipeline.sequence: ${CICD_EXECUTION_SEQUENCE}
...
- name: Another chart needs to wait until the previous one success
...
And in the chart-web-server
app, it has a deployment:在
chart-web-server
应用程序中,它有一个部署:
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-dpy
labels:
{{- include "labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}
{{- include "labels" . | nindent 6 }}
template:
metadata:
labels:
app: {{ .Release.Name }}
{{- include "labels" . | nindent 8 }}
spec:
containers:
- name: "web-server-{{ include "numericSafe" .Values.git.commitID }}"
image: "{{ .Values.harbor.host }}/{{ .Values.web.imageTag }}"
imagePullPolicy: Always
env:
...
ports:
- containerPort: {{ .Values.web.port }}
protocol: TCP
resources:
{{- .Values.resources | toYaml | nindent 12 }}
Now, I need the pipeline to be blocked until the deployment is upgraded since I want to do some server testing in the following stages.现在,我需要在部署升级之前阻塞管道,因为我想在以下阶段进行一些服务器测试。
My idea is to use Helm hook: If I can create a Job
hooking post-install
and post-upgrade
and waiting for the deployment to be completed, I can then block the whole pipeline until the deployment (a web server) is updated.我的想法是使用 Helm 挂钩:如果我可以创建一个
Job
挂钩post-install
post-upgrade
并等待部署完成,然后我可以阻止整个管道,直到部署(web 服务器)更新。
Does this idea work?这个想法行得通吗? If so, how can I write such a blocking and detecting
Job
?如果是这样,我该如何编写这样的阻塞和检测
Job
?
Does not appear to be supported from what I can find of their code.我从他们的代码中找到的似乎不支持。 It would appear they just shell out to
helm upgrade
, would need to use the --wait
mode.看来他们只是 shell 出来
helm upgrade
,需要使用--wait
模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.