diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 05e5125c..49215fbc 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -60,3 +60,10 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "kube-httpcache.kubeVersion" -}} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} \ No newline at end of file diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml index 9253ef68..e57ba1ed 100644 --- a/chart/templates/service.yaml +++ b/chart/templates/service.yaml @@ -25,3 +25,6 @@ spec: {{- end }} selector: {{- include "kube-httpcache.selectorLabels" . | nindent 4 }} + {{- if semverCompare ">=1.31-0" (include "kube-httpcache.kubeVersion" .) }} + trafficDistribution: {{ .Values.service.trafficDistribution.mode }} + {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index 688554bf..57eb90e0 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -13,6 +13,8 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +kubeVersion: "" + # Enable StatefulSet (Deployment is default) useStatefulset: enabled: true @@ -187,6 +189,8 @@ service: type: ClusterIP port: 80 target: 8080 + trafficDistribution: + mode: "PreferClose" # annotations: {} ingress: