Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1515532 - Any way to edit container internal label in OpenShift ?
Summary: Any way to edit container internal label in OpenShift ?
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: Ben Parees
QA Contact: Dongbo Yan
Depends On:
TreeView+ depends on / blocked
Reported: 2017-11-21 02:29 UTC by wangzhida
Modified: 2018-03-09 17:52 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-03-09 17:52:27 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description wangzhida 2017-11-21 02:29:44 UTC
Description of problem:
-The customer want to add/edit container internal label which is shown via command "docker inspect". They want to add labels when create the app in OCP. After some investigation, I found the labels seems defined in docker image like: said.

And I can not modify the image via "oc edit image sha:xxx". After save that, the changes will be recovered and deleted.

So I doubt the only way is to create image via dockerfile and setup custom S2I image in OCP, but it's really complex. Is there any easy way to edit these labels inside the docker container via OCP?

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:
-Can not modify the docker labels.

Expected results:
-To find a way to achieve that.

Additional info:
-This is not a bug report but we need some help from your team.thank you.

Comment 1 wangzhida 2017-11-23 06:24:22 UTC
The request from customer is use EFK in more efficient way:

Is there any way that I can add custom label to the container during deployment? I need this feature because I will read the label (i.e. "elasticsearch.index.rotation") to determine if the container logs should be sent to monthly or daily indices.

Such as label the new created container then they can config in fluentd to collect logs in every 1 hour and the others will collect in every 5 mins.

Looking forward to your reply, thank you.

Comment 2 Antonio Murdaca 2018-03-09 17:38:43 UTC
Changing Component as this is not something doable on the docker/cri-o side and the op is asking to do it from within OCP

Comment 3 Ben Parees 2018-03-09 17:52:27 UTC
The image/container labels come from the image, you would need to set the labels at image creation time (which our build api allows you to do).

If you want metadata on the deployment, then I suggest you use annotations or k8s pod labels to annotate the pod w/ the additional rules you want.  You can set those labels/annotations on the deploymentconfig's pod template so they are applied to the pod that is created.

You could also set an env variable on the pod, which would show up in a docker inspect of the container.

Note You need to log in before you can comment on or make changes to this bug.