Bug 1258354

Summary: Should fail when run "oc run" with invalid value for --image
Product: OKD Reporter: Yanping Zhang <yanpzhan>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED CURRENTRELEASE QA Contact: Yan Du <yadu>
Severity: low Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, dmcphers, jvallejo, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-19 13:53:39 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:

Description Yanping Zhang 2015-08-31 07:27:43 UTC
Description of problem:
When run "oc run test --image=%$%$%$%$%%%", it didn't give error info about --image, but still created resources.

Version-Release number of selected component (if applicable):
$ oc version
oc v1.0.5-89-gc9008aa
kubernetes v1.1.0-alpha.0-1605-g44c91b1


How reproducible:
Always

Steps to Reproduce:
1.Create instance with image:
$ oc run test --image=%$%$%$%$%%% -n project2
2.$ echo $?
3.$ oc get all -n project2
4.$ oc describe pod test-1-y1l1h -n project2.

Actual results:
1.Create without error info:
$ oc run test --image=%$%$%$%$%%% -n project2
NAME      TRIGGERS       LATEST VERSION
test      ConfigChange   0

2.
$ echo $?
0

3.
$ oc get all -n project2
NAME      TYPE      SOURCE
NAME      TYPE      STATUS    POD
NAME      DOCKER REPO   TAGS      UPDATED
NAME      TRIGGERS       LATEST VERSION
test      ConfigChange   1
CONTROLLER   CONTAINER(S)   IMAGE(S)      SELECTOR                                           REPLICAS   AGE
test-1       test           %$%$%$%$%%%   deployment=test-1,deploymentconfig=test,run=test   1          9m
NAME      HOST/PORT   PATH      SERVICE   LABELS    TLS TERMINATION
NAME      CLUSTER_IP   EXTERNAL_IP   PORT(S)   SELECTOR   AGE
NAME            READY     STATUS    RESTARTS   AGE
test-1-6qi6e    0/1       Pending   0          9m
test-1-deploy   1/1       Running   0          9m

4.
$ oc describe pod test-1-y1l1h -n project2
Name:				test-1-y1l1h
Namespace:			project2
Image(s):			%$%$%$%$%%%
Node:				ip-10-152-21-216/10.152.21.216
Labels:				deployment=test-1,deploymentconfig=test,run=test
Status:				Pending
Reason:				
Message:			
IP:				172.17.0.28
Replication Controllers:	test-1 (1/1 replicas created)
Containers:
  test:
    Image:		%$%$%$%$%%%
    State:		Waiting
    Ready:		False
    Restart Count:	0
    Variables:
Conditions:
  Type		Status
  Ready 	False 
Events:
  FirstSeen	LastSeen	Count	From				SubobjectPath				Reason		Message
  38s		38s		1	{scheduler }								scheduled	Successfully assigned test-1-y1l1h to ip-10-152-21-216
  37s		37s		1	{kubelet ip-10-152-21-216}	implicitly required container POD	pulled		Container image "openshift/origin-pod:latest" already present on machine
  37s		37s		1	{kubelet ip-10-152-21-216}	implicitly required container POD	created		Created with docker id a876364a93fc
  37s		37s		1	{kubelet ip-10-152-21-216}	implicitly required container POD	started		Started with docker id a876364a93fc
  37s		7s		4	{kubelet ip-10-152-21-216}	spec.containers{test}			failed		Failed to inspect image "%$%$%$%$%%%": parse /images/%$%$%$%$%%%/json: invalid URL escape "%$%"



Expected results:
1.Should fail to create and prompt error info about invalid value of image.
2.Should return 1.

Additional info:

Comment 1 Juan Vallejo 2016-08-05 19:37:44 UTC
Related PR: https://github.com/openshift/origin/pull/10250

Comment 2 Yanping Zhang 2016-08-15 02:50:50 UTC
Tested on devenv-rhel7_4821
oc v1.3.0-alpha.3+69c7837
kubernetes v1.3.0+507d3a7

# oc run test --image=%$%$%$%$%%% -n prozyp
error: Invalid image name "%$%$%$%$%%%": invalid reference format
# echo $?
1

The bug has been fixed, so move it to Verified.