rancher / rancher

Complete container management platform
http://rancher.com
Apache License 2.0
23.42k stars 2.97k forks source link

ExternalName service should not have ports #25455

Open oskapt opened 4 years ago

oskapt commented 4 years ago

What kind of request is this (question/bug/enhancement/feature request): bug

When creating an external service (hostname or IP mapping), it's possible to set port mapping values in the advanced section. Those ports appear in the resource definition YAML:

apiVersion: v1
kind: Service
metadata:
  annotations:
    field.cattle.io/creatorId: user-l5dmw
    field.cattle.io/ipAddresses: "null"
    field.cattle.io/targetDnsRecordIds: "null"
    field.cattle.io/targetWorkloadIds: "null"
  creationTimestamp: "2020-02-18T19:53:36Z"
  labels:
    cattle.io/creator: norman
  name: monachus
  namespace: default
  resourceVersion: "195099"
  selfLink: /api/v1/namespaces/default/services/monachus
  uid: bce68c44-3a98-46f9-8aa0-04db0843b975
spec:
  externalName: www.monach.us
  ports:
  - name: http
    port: 8080
    protocol: TCP
    targetPort: 80
  - name: https
    port: 4433
    protocol: TCP
    targetPort: 443
  sessionAffinity: None
  type: ExternalName
status:
  loadBalancer: {}

This implies that I can connect to the local alias on a local port, and it will be forwarded to the destination on the target port.

This is not the case. The port entries are ignored because an ExternalName service is a DNS CNAME. We should not allow users to configure ports, and ports should not be included in the YAML.

westlywright commented 4 years ago

@deniseschannon There is some backend work here, I can drop the ports inputs and the key from the payload before save (the ports param is created by default for the service type) but the backend is adding it back in with a default set of values on save. So in order for the UI to implement this the backend has to be fixed first.