Skip to content

Commit

Permalink
Make Service type configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitrii Ermakov authored and boynux committed Apr 10, 2023
1 parent 5e71d3c commit 7f771be
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ metadata:
{{- include "squid-exporter.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
{{- if or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
ports:
- port: {{ .Values.service.port }}
targetPort: metrics
protocol: TCP
name: metrics
{{- if or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer") }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
{{- include "squid-exporter.selectorLabels" . | nindent 4 }}
21 changes: 21 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,30 @@ securityContext:
# runAsUser: 1000

service:
# Kubernetes Service type, one of [ClusterIP, NodePort, LoadBalancer]
type: ClusterIP
port: 80

# Supports either ClientIP or None.
# Used to maintain session affinity.
# Enable client IP based session affinity.
# https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
sessionAffinity: ClientIP

# Service settings below are applicable only if
# service.type is one of [LoadBalancer, NodePort] and not ClusterIP.
# Possible values are [Cluster, Local].
# If set to Local, then the Service's port will be available only on Kubernetes
# Nodes which have the Squid Pods so no Kubernetes Node-to-Node traffic will be forwarded.
# If set to Cluster, then the Service's port will be available on any Node of
# a Kubernetes cluster. The drawback is that Kubernetes will use double NAT
# so it will hide the Client source IP from Squid.
externalTrafficPolicy: Cluster
# Node port to listen on. Typically, Kubernetes allows ports in range 30000-32767
# see https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
# for more information.
nodePort: ""

# Please pay attention that Kubernetes Ingress
# is designed to handle HTTP or HTTPS traffic and not proxy protocol
# so if you need to use Ingress, please ensure that your Ingress Controller
Expand Down

0 comments on commit 7f771be

Please sign in to comment.