Skip to content

Commit

Permalink
bump appVersion, allow multiple replicas (+HPA) for Deployment, allow…
Browse files Browse the repository at this point in the history
… setting externalService annotations, allow disabling allocateLoadBalancerNodePorts
  • Loading branch information
tamcore committed Dec 9, 2023
1 parent f18572c commit 495ec71
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charts/traccar/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: traccar
description: A Helm chart for Traccar GPS Server
type: application
version: 1.6.0
appVersion: "5.6"
version: 1.7.0
appVersion: "5.10"
dependencies:
- name: mysql
version: 9.4.8
Expand Down
8 changes: 6 additions & 2 deletions charts/traccar/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ metadata:
labels:
{{- include "traccar.labels" . | nindent 4 }}
spec:
replicas: 1
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "traccar.selectorLabels" . | nindent 6 }}
{{- with .Values.deploymentStrategy }}
strategy:
type: Recreate
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
Expand Down
32 changes: 32 additions & 0 deletions charts/traccar/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "traccar.fullname" . }}
labels:
{{- include "traccar.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "traccar.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/traccar/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ metadata:
name: {{ $externalfullname }}
labels:
{{- include "traccar.labels" . | nindent 4 }}
{{- with .Values.externalService.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.externalService.type }}
{{- if .Values.externalService.loadBalancerIP }}
loadBalancerIP: {{ .Values.externalService.loadBalancerIP }}
{{- end }}
{{- if .Values.externalService.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{ toYaml .Values.externalService.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if hasKey .Values.externalService "allocateLoadBalancerNodePorts" }}
allocateLoadBalancerNodePorts: {{ .Values.externalService.allocateLoadBalancerNodePorts }}
{{- end }}
ports:
{{- toYaml .Values.externalService.protocolPorts | nindent 4 }}
Expand Down
26 changes: 26 additions & 0 deletions charts/traccar/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ mysql:
persistence:
enabled: false

# NOTE: When using multiple replicas, you must configure broadcast.type and broadcast.address
# This must be done via configOverride. See https://www.traccar.org/configuration-file/#:~:text=attributes%20to%20log.-,broadcast.type,-config
replicaCount: 1

deploymentStrategy:
# Recreate has been the default until chart version 1.6.0 and is required if running a non-HA compatible setup
type: Recreate
# rollingUpdate:
# maxSurge: 25%
# maxUnavailable: 25%
# type: RollingUpdate

image:
repository: traccar/traccar
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -193,8 +205,15 @@ service:
externalService:
type: LoadBalancer
enabled: false
annotations: {}
# metallb.universe.tf/loadBalancerIPs: 192.168.1.100
# loadBalancerIP: ""
# loadBalancerSourceRanges: []

# -- Enable node port allocation for the external controller service or not. Applies to type `LoadBalancer` only.
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-nodeport-allocation
# allocateLoadBalancerNodePorts: true

protocolPorts:
- name: gps103
port: 5001
Expand Down Expand Up @@ -876,6 +895,13 @@ externalService:

resources: {}

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nodeSelector:

tolerations: []
Expand Down

0 comments on commit 495ec71

Please sign in to comment.