Docker CI/CD更新多容器吊舱

Docker CI/CD更新多容器吊舱,docker,kubernetes,continuous-integration,gitlab,Docker,Kubernetes,Continuous Integration,Gitlab,我正试图通过管道构建一个多容器吊舱,并通过头盔图表发布 对于单个集装箱吊舱,我可以这样做,将集装箱的版本和位置传递到舵图: helm upgrade --install \ --set image.repository=${CI_REGISTRY}/${ENVIRONMENT,,}/${CI_PROJECT_NAME} \ --set image.tag=${CI_COMMIT_SHA} \ ${CI_PROJECT_NAME} \ 如果帮助图表是多容器pod,如何传

我正试图通过管道构建一个多容器吊舱,并通过头盔图表发布

对于单个集装箱吊舱,我可以这样做,将集装箱的版本和位置传递到舵图:

    helm upgrade --install \
   --set image.repository=${CI_REGISTRY}/${ENVIRONMENT,,}/${CI_PROJECT_NAME} \
   --set image.tag=${CI_COMMIT_SHA} \
   ${CI_PROJECT_NAME} \
如果帮助图表是多容器pod,如何传递特定容器的版本或位置

containers:
        - repo: myrepo/qa/helloworld1
          tag: e2fd70931d264490b2d25012e884897f970f5916
          pullPolicy: Always
          ports:
            container: 8090
          livenessProbe:
            initialDelaySeconds: 6
            tcpSocket:
              port: 8090
          resources:
              requests:
                memory: 128Mi
                cpu: 50m
              limits:
                memory: 128Mi
                cpu: 100m
        - repo: myrepo/qa/helloworld2
          tag: 6bb39948f2a5f926f7968480435ec39a4e07e721
          pullPolicy: Always
          ports:
            container: 8080
          livenessProbe:
            initialDelaySeconds: 6
            tcpSocket:
              port: 8080
          resources:
              requests:
                memory: 128Mi
                cpu: 50m
              limits:
                memory: 128Mi
                cpu: 100m




这取决于你的舵图。之所以可以传递image.tag和image.repository部分,是因为在helm图表模板中有一个部分指定了以下内容:

containers:
  - image: {{ .Values.image.repository }}/app-name:{{ .Values.image.tag }}
头盔模板a部署.yaml。默认情况下,它将图表中的每个值替换为作为该图表一部分的Values.yaml文件中指定的任何默认值。无论何时运行helm命令,如
helm install
helm upgrade--install
并指定
--set
标志,都将覆盖values.yaml中指定的默认值。看

回答你的问题:这取决于图表是如何定义的。您经常看到的是,在多容器吊舱的values.yaml中,您定义了两组图像,例如:

# values.yaml
image1:
  tag: <sha-here>
  repository: <repo-here>

image2:
  tag: <sha-here>
  repository: <repo-here>
但是,这取决于指定这些值的特定舵图。你能更新你的掌舵图吗?还是外部图表

containers:
  - image: {{ .Values.image1.repository }}/app-name:{{ .Values.image1.tag }}