Skip to content

Commit

Permalink
fix otel col compatible for kubernetes before 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredTan95 committed Aug 21, 2023
1 parent a928378 commit 87c18d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions charts/opentelemetry-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ Compute Service creation on mode
Compute InternalTrafficPolicy on Service creation
*/}}
{{- define "opentelemetry-collector.serviceInternalTrafficPolicy" }}
{{- if (semverCompare ">= 1.21-0" .Capabilities.KubeVersion.Version) -}}
{{- if and (eq .Values.mode "daemonset") (eq .Values.service.enabled true) }}
{{- print (.Values.service.internalTrafficPolicy | default "Local") -}}
{{- printf "internalTrafficPolicy: %s" (.Values.service.internalTrafficPolicy | default "Local") }}
{{- else }}
{{- print (.Values.service.internalTrafficPolicy | default "Cluster") -}}
{{- printf "internalTrafficPolicy: %s" (.Values.service.internalTrafficPolicy | default "Cluster") }}
{{- end }}
{{- end -}}
{{- end -}}


2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig:
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $podValues := deepCopy .Values }}
Expand Down
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
selector:
{{- include "opentelemetry-collector.selectorLabels" . | nindent 4 }}
{{- include "opentelemetry-collector.component" . | nindent 4 }}
internalTrafficPolicy: {{ include "opentelemetry-collector.serviceInternalTrafficPolicy" . }}
{{ include "opentelemetry-collector.serviceInternalTrafficPolicy" . | nindent 2 }}
{{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.externalTrafficPolicy) }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
Expand Down

0 comments on commit 87c18d4

Please sign in to comment.