Skip to content

TCP Host Ports are not correctly rendered when .Values.controller.tcp is not defined #97

@bapung

Description

@bapung

Description

I am trying to setting up a Gitea SSH with Gateway API's TCPRoute, my haproxy-ingress is running as daemonSet using useHostPort: true option. Here's myvalues.yaml:

controller:
  ingressClassResource:
    enabled: true
  kind: DaemonSet
  daemonset:
    useHostPort: true
    hostPorts:
      tcp:
        - "2222"
  service:
    type: ClusterIP
  config:
    limit-connections: "10"
    limit-rps: "50"

This should render the _podtemplate.yaml with extra TCP ports like this, which enable haproxy pod to listen at host port 2222.

- containerPort: 2222
  hostPort: 2222
  name: gitea-ssh
  protocol: TCP

However, it seems that the controller.daemonset.hostPorts.tcp is only rendered IF controller.tcp is defined.

Goals

  1. For pure Gateway API TCPRoute configuration, we don't want to define controller.tcp in values.yaml as it is redundant.

Proposed solution

Thinking of this new value controller.daemonset.extraHostPorts similar to existing controller.service.extraPorts:

in _podtemplate.yaml

{{- define "haproxy-ingress.controller.ports" }}
{{- /* existing codes */}}
{{- if $.Values.controller.daemonset.useHostPort }}
{{- range $row := .Values.controller.daemonset.extraHostPorts }}
- name: "extra-port-{{ $row.port }}"
  containerPort: {{ $row.containerPort }}
  hostPort: {{ $row.hostPort }}
{{- end }}
{{- end }}
{{- end }}

Expected working values.yaml

controller:
  kind: DaemonSet
  daemonset:
    useHostPort: true
    extraHostPorts:
      - port: "2222"
        containerPort: "2222"
        hostPort: "2222"
  service:
    type: ClusterIP
## rest of val

Made a quick test this morning and it's working fine with TCPRoute, I can do pull request if this proposal is approved.

Image

Thank you.

Metadata

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