Bug 1378012

Summary: [platformmanagement_public_624]Should have '--nodeport' option for 'oc create service nodeport' command
Product: OKD Reporter: zhou ying <yinzhou>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED CURRENTRELEASE QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, cewong, jvallejo, mmccomas, xxia, yinzhou
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-09 21: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:

Description zhou ying 2016-09-21 10:03:22 UTC
Description of problem:
Didn't have '--nodeport' option for create nodeport service , couldn't specify the nodeport  for nodeport  service.

Version-Release number of selected component (if applicable):
openshift version
openshift v1.4.0-alpha.0+16f2d39
kubernetes v1.4.0-beta.3+d19513f
etcd 3.0.9

How reproducible:
Always

Steps to Reproduce:
1. Login OpenShift and create project;
2. Check help info for create nodeport service command;


Actual results:
2. There was no '--nodeport' option for nodeport service command


Expected results:
2. Should have  option for create nodeport service to specify the nodeport.


Additional info:

Comment 1 Juan Vallejo 2016-09-21 15:06:32 UTC
Hm, could you clarify a bit more on this bug? I believe I may be misunderstanding this bug:

Although `oc create service nodeport` does not have a `--nodeport` option, it does have a `--tcp` option which takes a "<port>:<target_port>".

1. Create a new nodeport service
`$ oc create service nodeport mynodeport --tcp=80:8080`

2. Describe this service
```
$ oc describe service/mynodeport

Name:                   mynodeport
Namespace:              default
Labels:                 app=mynodeport
Selector:               app=mynodeport
Type:                   NodePort
IP:                     172.30.149.2
Port:                   80-8080 80/TCP
NodePort:               80-8080 30206/TCP
Endpoints:              <none>
Session Affinity:       None
No events.
```

As can be seen in the above case, although there is no `--nodeport` option, a "nodeport" value can still be specified through the command with `--tcp`.

Version:

oc v1.3.0-rc1+2b9e40a-dirty
kubernetes v1.4.0-beta.3+d19513f
features: Basic-Auth

Server https://10.13.137.149:8443
openshift v1.3.0-rc1
kubernetes v1.3.0+52492b4

Comment 2 zhou ying 2016-09-22 03:41:21 UTC
But the nodeport (NodePort:   80-8080 30206/TCP)  is random from the range, if has option, we could specify the nodeport.

Comment 3 Cesar Wong 2016-09-22 14:23:36 UTC
Juan, Zhou, yes, I see what you mean. If you don't want the nodeport to be randomly generated, you'd need to specify it somehow. Juan, I can show you where that could be set.

Comment 4 Juan Vallejo 2016-09-22 19:44:05 UTC
Thanks for your help Cesar!

Related PR: https://github.com/openshift/origin/pull/11059

Comment 5 zhou ying 2016-10-11 05:30:05 UTC
Confirmed with the latest origin ami , the issue has fixed:
openshift version
openshift v1.4.0-alpha.0+606716e
kubernetes v1.4.0+776c994
etcd 3.1.0-alpha.1


[zhouy@zhouy testjson]$ oc create service nodeport hello-pod --tcp=5678:8080 --node-port=30899
service "hello-pod" created
[zhouy@zhouy testjson]$ oc get service
NAME        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
hello-pod   172.30.43.122   <nodes>       5678/TCP   <invalid>
[zhouy@zhouy testjson]$ oc describe service hello-pod
Name:			hello-pod
Namespace:		zhouy
Labels:			app=hello-pod
Selector:		app=hello-pod
Type:			NodePort
IP:			172.30.43.122
Port:			5678-8080	5678/TCP
NodePort:		5678-8080	30899/TCP
Endpoints:		172.17.0.2:8080
Session Affinity:	None
No events.


[root@ip-172-18-4-233 ~]# curl 172.18.4.233:30899
Hello OpenShift!