Skip to content

Allow NodePort configuration via values.yamlΒ #55

@federico-laurianti

Description

@federico-laurianti

Currently, when setting service.type: NodePort in the service.yaml, it is not possible to configure nodePort values directly through values.yaml.

This requires manual intervention, such as running:

kubectl patch svc seq -n seq --type=json -p="[{\"op\": \"replace\", \"path\": \"/spec/ports/0/nodePort\", \"value\": 30038}, {\"op\": \"replace\", \"path\": \"/spec/ports/1/nodePort\", \"value\": 30039}]"

To avoid this, I propose allowing nodePort configuration directly via values.yaml.
For example, the first two ports in the service.yaml could be modified like this:

  ports:
    - port: {{ .Values.ui.service.port }}
      targetPort: ui
      protocol: TCP
      name: ui
      {{- if eq .Values.service.type "NodePort" }}
      nodePort: {{ .Values.ui.service.nodePort }}
      {{- end }}
    - port: {{ .Values.ingestion.service.port }}
      targetPort: ingestion
      protocol: TCP
      name: ingestion
      {{- if eq .Values.service.type "NodePort" }}
      nodePort: {{ .Values.ingestion.service.nodePort }}
      {{- end }}

This would allow users to specify nodePort in values.yaml like so:

# The complete Seq API and UI.
# This API can accept events and serve API requests.
ui:
  containerPort: 80
  service:
    port: 80
    nodePort: 30038
  ingress:
    enabled: false
    path: /
    hosts: []

# The ingestion-only API.
# This API is a subset of ui that can only ingest events.
ingestion:
  containerPort: 5341
  service:
    port: 5341
    nodePort: 30039
  ingress:
    enabled: false
    path: /
    hosts: []

This approach could also be extended to other ports such as gelf and syslog, making the chart more flexible and user-friendly. Each port can have its nodePort configured explicitly in values.yaml.

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