Skip to content

Commit 0fc4aff

Browse files
feat(cf-common): add trafficDistribution for services
1 parent fe09bb5 commit 0fc4aff

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

charts/cf-common/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: v0.0.0
33
description: Codefresh library chart
44
name: cf-common
5-
version: 0.25.0
5+
version: 0.26.0
66
type: library
77
keywords:
88
- codefresh

charts/cf-common/templates/services/_services.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ spec:
9191
{{- if $serviceItem.extraSelectorLabels }}
9292
{{- include "cf-common-0.25.0.tplrender" (dict "Values" $serviceItem.extraSelectorLabels "context" $) | nindent 4 }}
9393
{{- end }}
94+
{{- if semverCompare ">=1.31-0" (include "cf-common-0.25.0.kubeVersion" . ) }}
95+
{{- if $serviceItem.trafficDistribution }}
96+
trafficDistribution: {{ $serviceItem.trafficDistribution | default "PreferClose" }}
97+
{{- end }}
98+
{{- end -}}
9499
{{- end }}
95100
{{- end }}
96101

charts/cf-common/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ service:
469469
targetPort:
470470
# If `targetPort` is specified, this port number is used in the container definition instead of
471471
# the `port` value. Therefore named ports are not supported for this field
472+
# -- Enable trafficDistribution
473+
# Ref: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution
474+
# trafficDistribution: "PreferClose"
472475

473476
# -- Configure the Ingresses for the chart.
474477
# Additional Ingresses can be added by adding a dictionary key similar to the 'main' ingress.

0 commit comments

Comments
 (0)