简体   繁体   English

标记 Openshift Build 临时 Pod

[英]Labelling Openshift Build transient pods

I have a simple S2I build running on an Openshift 3.11 project that outputs to an Image Stream.我有一个在 Openshift 3.11 项目上运行的简单 S2I 构建,该项目输出到图像流。

The build is working fine, the resulting images are tagged correctly and available in the stream.构建工作正常,生成的图像被正确标记并在流中可用。 My issue is, each build spins up a transient pod to handle doing the actual build.我的问题是,每个构建都会启动一个临时 pod 来处理实际构建。 I would like to label these pods.我想给这些豆荚贴上标签。 This project is shared between multiple teams and we have several scripts that differentiate pods based on a label.这个项目在多个团队之间共享,我们有几个脚本可以根据标签区分 pod。

Right now each one automatically gets labelled like so:现在每一个都会自动被标记如下:

openshift.io/build.name: <buildname>-<buildnum>

Which is fine, I don't want to get rid of that label.这很好,我不想摆脱那个标签。 I just want to add an additional custom label (something like owner: <teamname> ).我只想添加一个额外的自定义标签(类似于owner: <teamname> )。 How can I do that?我怎样才能做到这一点?

You can add your custom label using imageLabels section in the buildConfig as follows.您可以使用imageLabels中的buildConfig部分添加自定义标签,如下所示。 Further information is here, Output Image Labels .更多信息在此处, 输出图像标签

spec:
  output:
    to:
      kind: "ImageStreamTag"
      name: "your-image:latest"
    imageLabels:
    - name: "owner"
      value: "yourteamname"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM