Bug 1398062

Summary: Create ExternalName services with spec.ports should fail or ignore ports value
Product: OpenShift Container Platform Reporter: Zhang Cheng <chezhang>
Component: NodeAssignee: dhodovsk
Status: CLOSED WONTFIX QA Contact: DeShuai Ma <dma>
Severity: low Docs Contact:
Priority: medium    
Version: 3.4.0CC: aos-bugs, bmeng, decarr, jokerman, mmccomas
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: 2017-01-31 15:38:13 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 Zhang Cheng 2016-11-24 02:38:02 UTC
Description of problem: Create ExternalName services with spec.ports should fail or ignore ports value 

Version-Release number of selected component (if applicable):
openshift v3.4.0.29+ca980ba
kubernetes v1.4.0+776c994

How reproducible:
Always

Steps to Reproduce:
1. Try to create a externalname service with spec.ports
# cat ExternalSvc-with-port.yaml
apiVersion: v1
kind: Service
metadata:
  name: my-svc
spec:
  ports:
  - port: 12345
  type: ExternalName
  externalName: www.google.com

Actual results:
# oc create -f ExternalSvc-with-port.yaml
service "my-svc" created
# oc get svc
NAME      CLUSTER-IP   EXTERNAL-IP     PORT(S)     AGE
my-svc                 www.google.com   12345/TCP   5s
# oc describe svc my-svc
Name:			my-svc
Namespace:		chezhang
Labels:			<none>
Selector:		<none>
Type:			ExternalName
IP:			
External Name:		www.google.com
Port:			<unset>	12345/TCP
Endpoints:		<none>
Session Affinity:	None
No events.
# oc get svc my-svc -o yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: 2016-11-23T08:59:05Z
  name: my-svc
  namespace: chezhang
  resourceVersion: "26312"
  selfLink: /api/v1/namespaces/chezhang/services/my-svc
  uid: 16638755-b15b-11e6-8ee4-42010af00003
spec:
  externalName: www.google.com
  ports:
  - port: 12345
    protocol: TCP
    targetPort: 12345
  sessionAffinity: None
  type: ExternalName
status:
  loadBalancer: {}

Expected results: 
The service should be created failed, or created but ignore spec.port value in `oc get svc`, `oc describe svc` and `oc get svc -o yaml`.

Addition info: 
I did a compare test, tried to create a externalname service with spec.clusterIP, the actual results is create externalname service failed.
# cat ExternalSvc-with-IP.yaml
apiVersion: v1
kind: Service
metadata:
  name: my-svc
spec:
  clusterIP: 172.30.162.30
  type: ExternalName
  externalName: www.google.com
# oc create -f ExternalSvc-with-IP.yaml
The Service "my-svc" is invalid: spec.clusterIP: Invalid value: "172.30.162.30": must be empty for ExternalName services

Comment 2 Derek Carr 2017-01-31 15:38:13 UTC
See comment:
https://github.com/kubernetes/kubernetes/pull/39938#issuecomment-276133370

Unfortunately, closing this as wont fix, we can evaluate in future iterations of the API.