Bug 1190052 - Validation of namespace length should occur during namespace creation
Summary: Validation of namespace length should occur during namespace creation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.x
Assignee: Jordan Liggitt
QA Contact: weiwei jiang
URL:
Whiteboard:
: 1218983 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-06 08:03 UTC by Wenjing Zheng
Modified: 2016-10-30 22:54 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-07 23:44:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wenjing Zheng 2015-02-06 08:03:35 UTC
Description:
When create namespace with less than 4 characters in name/label, it has no warning; but if build under it, there will be warning about "Build error: API error (500): Invalid namespace name (w2). Cannot be fewer than 4 or more than 30 characters." 

Version-Release number of selected component (if applicable):
openshift-sdn-master-0.4-1.el7.x86_64
openshift-master-0.2.2-0.git.83.6d09bd9.el7ose.x86_64
openshift-sdn-0.4-1.el7.x86_64
openshift-0.2.2-0.git.83.6d09bd9.el7ose.x86_64
kubernetes v0.10.0-dev

How reproducible:
always

steps to Reproduce:
1. Create namespace with less than 4 characters
2. Create resouces under this namespace
3. Triger build

Actual results:
Build will be failed with below error:
[root@ose-v3-beta1-master sample-app]# osc build-logs 1078d163-adbe-11e4-a753-fa163ee200ce -n w2
2015-02-06T05:08:11.915349657Z Cloning into '/tmp/docker-build650986152'...
2015-02-06T05:08:12.772927359Z 2015/02/06 05:08:12 Build error: API error (500): Invalid namespace name (w2). Cannot be fewer than 4 or more than 30 characters.

Expected results:
If namespace cannnot be create with less than 4 characters, validation should be earlier, like during creation.

Additional info:

Comment 2 Yanping Zhang 2015-05-07 02:21:55 UTC
*** Bug 1218983 has been marked as a duplicate of this bug. ***

Comment 3 Jordan Liggitt 2015-05-17 03:02:21 UTC
Also see https://github.com/openshift/origin/issues/1232

Comment 4 Jordan Liggitt 2015-05-17 03:04:43 UTC
Namespaces are a Kubernetes object, and builds are an OpenShift object, so we can't place requirements on namespace name validation based on builds.

Comment 5 Jordan Liggitt 2015-05-19 19:24:48 UTC
The v2 docker registry has the following restrictions on image repository path components:

1. total length <= 255
2. each segment length >= 2
3. only valid characters are a-z0-9_.-

The namespace and the image stream name are combined with a "/" to form an image repository path.

https://github.com/openshift/origin/pull/2351 will add the following validation:

1. Require Project names to be >= 2 characters on creation
2. Require ImageStream namespaces to be >= 2 characters
3. Require ImageStream namespace+'/'+name to be <= 255 characters
4. Require ImageStream names to be valid docker image repository names
5. Validate dockerImageReference path component length and characters

To ensure we don't break updating an existing project/namespace that was created with a single character name, allow updating projects with names < 2 characters

Comment 6 Jordan Liggitt 2015-05-22 02:59:55 UTC
Merged in https://github.com/openshift/origin/pull/2351

Note that "5. Validate dockerImageReference path component length and characters" was not done because it was too impactful a change.

Comment 7 weiwei jiang 2015-05-26 07:04:20 UTC
Checked with fedora_1614, and Can not reproduce this issue with namespace which name is less than 4 chars.


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