Bug 1683819

Summary: empty value for key on label is actually valid for nodeselector (and other uses)
Product: OpenShift Container Platform Reporter: Erik M Jacobs <ejacobs>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: low Docs Contact:
Priority: low    
Version: 4.1.0CC: aos-bugs, jokerman, mmccomas, sponnaga
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:27:41 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:

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.