Skip to content

Commit

Permalink
Update PodDisruptionBudgets API version (#835)
Browse files Browse the repository at this point in the history
Capabilities.KubeVersion.Version checks the kube version. If above 1.21, apiVersion: policy/v1 is set for PodDisruptionBudget, else apiVersion: policy/v1beta1.
  • Loading branch information
legoGoat authored Jun 27, 2023
1 parent 715d20e commit 06d3588
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- Update PodDisruptionBudgets API version to allow both `policy/v1beta1` and `policy/v1` [#835](https://github.com/signalfx/splunk-otel-collector-chart/pull/835)

## [0.80.0] - 2023-06-27

This Splunk OpenTelemetry Collector for Kubernetes release adopts the [Splunk OpenTelemetry Collector v0.80.0](https://github.com/signalfx/splunk-otel-collector/releases/tag/v0.80.0).
Expand Down
11 changes: 11 additions & 0 deletions helm-charts/splunk-otel-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,17 @@ compatibility with the old config group name: "otelAgent".
{{- end }}
{{- end -}}

{{/*
The apiVersion for podDisruptionBudget policies.
*/}}
{{- define "splunk-otel-collector.PDB-apiVersion" -}}
{{- if (semverCompare ">= 1.21.0" .Capabilities.KubeVersion.Version) -}}
{{- print "policy/v1" -}}
{{- else -}}
{{- print "policy/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
The name of the gateway service.
*/}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and (eq (include "splunk-otel-collector.clusterReceiverEnabled" . ) "true" ) .Values.podDisruptionBudget }}
apiVersion: policy/v1beta1
apiVersion: {{ include "splunk-otel-collector.PDB-apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "splunk-otel-collector.fullname" . }}-otel-k8s-cluster-receiver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ $gateway := fromYaml (include "splunk-otel-collector.gateway" .) }}
{{ $gatewayEnabled := eq (include "splunk-otel-collector.gatewayEnabled" .) "true" }}
{{- if and $gatewayEnabled .Values.podDisruptionBudget }}
apiVersion: policy/v1beta1
apiVersion: {{ include "splunk-otel-collector.PDB-apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "splunk-otel-collector.fullname" . }}
Expand Down

0 comments on commit 06d3588

Please sign in to comment.