Skip to content

Specifying a service's port name instead of number does not work #211

Open
@lion7

Description

I just installed a Helm chart (the Element OnPrem server to be precise) which installs the following Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: first-element-deployment-synapse
  namespace: element-onprem
spec:
  rules:
  - host: ***MASKED***
    http:
      paths:
      - backend:
          service:
            name: first-element-deployment-synapse-haproxy
            port:
              name: haproxy-http
        path: /_matrix
        pathType: Prefix
      - backend:
          service:
            name: first-element-deployment-synapse-haproxy
            port:
              name: haproxy-http
        path: /_synapse
        pathType: Prefix

Note that the service port is referenced by name and not by number. This breaks when using Caddy Ingress, which I figured would be due to the following line:

clusterHostName := fmt.Sprintf("%v.%v.svc.cluster.local:%d", path.Backend.Service.Name, ing.Namespace, path.Backend.Service.Port.Number)

Basically it just returns port 0 here because the port number should be resolved by name instead of directly using the number.

@mavimo Would you be open to a PR to fix this?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions