Labelling Openshift Build transient pods

160 views Asked by At

I have a simple S2I build running on an Openshift 3.11 project that outputs to an Image Stream.

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. 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.

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>). How can I do that?

1

There are 1 answers

1
Daein Park On

You can add your custom label using imageLabels section in the buildConfig as follows. Further information is here, Output Image Labels.

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