Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controller.extraServices list #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions haproxy-ingress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ Parameter | Description | Default
`controller.service.httpPorts` | The http ports to open, that map to the Ingress' port 80. Each entry specifies a `port`, `targetPort` and an optional `nodePort`. | `[ port: 80, targetPort: http ]`
`controller.service.httpsPorts` | The https ports to open, that map to the Ingress' port 443. Each entry specifies a `port`, `targetPort` and an optional `nodePort`. | `[ port: 443 , targetPort: https]`
`controller.service.type` | type of controller service to create | `LoadBalancer`
`controller.extraServices` | The list of extra controller services. Each service accepts `controller.service` keys. | `[]`
`controller.stats.enabled` | whether to enable exporting stats | `false`
`controller.stats.port` | The port number used haproxy-ingress-controller for haproxy statistics | `1936`
`controller.stats.hostPort` | The host port number used haproxy-ingress-controller for haproxy statistics | `~`
Expand Down
92 changes: 92 additions & 0 deletions haproxy-ingress/templates/controller-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,95 @@ spec:
selector:
{{- include "haproxy-ingress.selectorLabels" . | nindent 4 }}
type: "{{ .Values.controller.service.type }}"
{{- range $i, $svc := .Values.controller.extraServices }}
---
kind: Service
metadata:
{{- if $svc.annotations }}
annotations:
{{- toYaml $svc.annotations | nindent 4 }}
{{- end }}
labels:
{{- include "haproxy-ingress.labels" $ | nindent 4 }}
{{- if $svc.labels }}
{{- toYaml $svc.labels | nindent 4 }}
{{- end }}
name: {{ include "haproxy-ingress.fullname" $ }}-extra-{{ $i }}
namespace: {{ $.Release.Namespace }}
spec:
{{- if $svc.clusterIP }}
clusterIP: "{{ $svc.clusterIP }}"
{{- end }}
{{- if $svc.clusterIPs }}
clusterIPs:
{{- toYaml $svc.clusterIPs | nindent 4 }}
{{- end }}
{{- if or $svc.externalTrafficPolicy $.Values.controller.service.externalTrafficPolicy }}
{{- if or (eq (default $.Values.controller.service.type $svc.type) "NodePort") (eq (default $.Values.controller.service.type $svc.type) "LoadBalancer") }}
externalTrafficPolicy: "{{ default $.Values.controller.service.externalTrafficPolicy $svc.externalTrafficPolicy }}"
{{- end }}
{{- end }}
{{- if $svc.externalIPs }}
externalIPs:
{{- toYaml $svc.externalIPs | nindent 4 }}
{{- end }}
{{- if $svc.ipFamilies }}
ipFamilies:
{{- toYaml $svc.ipFamilies | nindent 4 }}
{{- end }}
{{- if $svc.ipFamilyPolicy }}
ipFamilyPolicy: {{ $svc.ipFamilyPolicy | quote }}
{{- end }}
{{- if $svc.loadBalancerClass }}
loadBalancerClass: "{{ $svc.loadBalancerClass }}"
{{- end }}
{{- if $svc.loadBalancerIP }}
loadBalancerIP: "{{ $svc.loadBalancerIP }}"
{{- end }}
{{- if $svc.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml $svc.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if ($svc.healthCheckNodePort) }}
healthCheckNodePort: {{ $svc.healthCheckNodePort }}
{{- end }}
ports:
{{- if $.Values.controller.enableStaticPorts }}
{{- range default $.Values.controller.service.httpPorts $svc.httpPorts }}
- name: "http-{{ .port }}"
port: {{ .port }}
protocol: TCP
targetPort: {{ .targetPort | default "http" }}
{{- if (not (empty .nodePort)) }}
nodePort: {{ .nodePort }}
{{- end }}
{{- end }}
{{- range default $.Values.controller.service.httpsPorts $svc.httpsPorts }}
- name: "https-{{ .port }}"
port: {{ .port }}
protocol: TCP
targetPort: {{ .targetPort | default "https" }}
{{- if (not (empty .nodePort)) }}
nodePort: {{ .nodePort }}
{{- end }}
{{- end }}
{{- end }}
{{- range $key, $value := $.Values.controller.tcp }}
- name: "{{ tpl $key $ }}-tcp"
port: {{ tpl $key $ }}
protocol: TCP
targetPort: "{{ tpl $key $ }}-tcp"
{{- end }}
{{- range $row := $svc.extraPorts }}
- name: "extra-port-{{ $row.port }}"
port: {{ $row.port }}
protocol: TCP
targetPort: {{ $row.targetPort }}
{{- if (not (empty $row.nodePort)) }}
nodePort: {{ $row.nodePort }}
{{- end }}
{{- end }}
selector:
{{- include "haproxy-ingress.selectorLabels" $ | nindent 4 }}
type: "{{ default $.Values.controller.service.type $svc.type }}"
{{- end }}
4 changes: 4 additions & 0 deletions haproxy-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ controller:

type: LoadBalancer

## Add extra services
## Refer to controller.service for available keys
extraServices: []

## If controller.haproxy.enabled = true, an external haproxy instance
## is configured and managed as a sidecar container
haproxy:
Expand Down