Bug 2089402

Summary: BuildConfig throws error when using a label with a / in it
Product: OpenShift Container Platform Reporter: Alok Singh <alosingh>
Component: BuildAssignee: jawed <jkhelil>
Status: CLOSED ERRATA QA Contact: Jitendar Singh <jitsingh>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: cdaley, pkumari, spandura
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-17 19:48:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2105167    

Description Alok Singh 2022-05-23 15:04:38 UTC
Description of problem:

When using a label with a / in it in buildconfig, it throws an error like below:

"The BuildConfig "cpd-cli" is invalid: spec.output.imageLabels[0].name: Invalid value: "app.kubernetes.io/part-of": a valid config key must consist of alphanumeric characters, '-', '_' or '.' (e.g. 'key.name',  or 'KEY_NAME',  or 'key-name', regex used for validation is '[-._a-zA-Z0-9]+')"

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

How reproducible:
Always

Steps to Reproduce:
1. Create a buildconfig manifest having 'imageLabels:' option and the label name  having a / in it like below:

    imageLabels:
      - name: app.kubernetes.io/part-of
        value: customized-app
2. Try to create the buildconfig using 'oc create -f <file-name>'
3. It throws the mentioned error and does't allow a label with / in it

Actual results:
Getting the mentioned error when trying to use a label with / in it

Expected results:
The buildconfig should get created without any error. It should accept a label with /.

Additional info:

Comment 2 jawed 2022-07-06 08:39:40 UTC
hi @alosingh 
I am proposing a fix in the this PR https://github.com/openshift/openshift-apiserver/pull/292

Comment 5 Priti Kumari 2022-07-12 14:11:14 UTC
verified.

Comment 10 errata-xmlrpc 2023-01-17 19:48:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.12.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7399