Bug 1683819 - empty value for key on label is actually valid for nodeselector (and other uses)
Summary: empty value for key on label is actually valid for nodeselector (and other uses)
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.2.0
Assignee: Maciej Szulik
QA Contact: zhou ying
Depends On:
TreeView+ depends on / blocked
Reported: 2019-02-27 21:44 UTC by Erik M Jacobs
Modified: 2019-10-16 06:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Wrong validation for node selector labels. Consequence: Empty value for key on label is not being accepted. Fix: Fix node selector label validation mechanism. Result: Empty value for key on label is valid node selector.
Clone Of:
Last Closed: 2019-10-16 06:27:41 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2922 0 None None None 2019-10-16 06:27:49 UTC

Description Erik M Jacobs 2019-02-27 21:44:11 UTC
Description of problem:
node-role.kubernetes.io/infra="" is a valid label

oc should accept it as --node-selector.

Version-Release number of selected component (if applicable):
[root@ip-172-31-41-122 190227]# oc version
Client Version: version.Info{Major:"4", Minor:"0+", GitVersion:"v4.0.0-0.185.0", GitCommit:"e883da29bc", GitTreeState:"", BuildDate:"2019-02-25T13:48:37Z", GoVersion:"", Compiler:"", Platform:""}
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.4+c547bc3e86", GitCommit:"c547bc3e86", GitTreeState:"clean", BuildDate:"2019-02-26T04:32:16Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

How reproducible:

Steps to Reproduce:
1. oc adm new-project openshift-logging --node-selector='node-role.kubernetes.io/infra='

Actual results:
The Project "openshift-logging" is invalid: nodeSelector: Invalid value: "node-role.kubernetes.io/infra=": must be a valid label selector

Expected results:
Project created

Additional info:
Apparently our validator/parser doesn't treat these as valid, even though they are and are used natively within k8s.

I think this is related to https://github.com/openshift/origin/issues/21972

Comment 1 Maciej Szulik 2019-03-01 13:10:24 UTC
Fix in https://github.com/openshift/origin/pull/22203

Comment 2 zhou ying 2019-03-22 05:10:55 UTC
The issue has fixed:
[root@dhcp-140-138 roottest]# oc version --short
Client Version: v4.0.22
Server Version: v1.12.4+560ec64

Payload: 4.0.0-0.nightly-2019-03-22-002648

[root@dhcp-140-138 roottest]# oc adm new-project openshift-loggingzz --node-selector='node-role.kubernetes.io/infra='
Created project openshift-loggingzz

Comment 4 errata-xmlrpc 2019-10-16 06:27:41 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, and where to find the updated
files, follow the link below.

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


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