Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pdb to fluentd helm chart #445

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions charts/fluentd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,15 @@ Name of the configMap used for additional configuration files; allows users to o
{{ printf "%s-%s" "fluentd-config" ( include "fluentd.shortReleaseName" . ) }}
{{- end -}}
{{- end -}}


{{/*
Pdb apiVersion according k8s version and capabilities
*/}}
{{- define "fluentd.pdb.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "policy/v1") (semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion) -}}
policy/v1
{{- else -}}
policy/v1beta1
{{- end }}
{{- end -}}
21 changes: 21 additions & 0 deletions charts/fluentd/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if and (or ( eq .Values.kind "Deployment" ) ( eq .Values.kind "StatefulSet" )) .Values.podDisruptionBudget.enabled }}
apiVersion: {{ include "fluentd.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "fluentd.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "fluentd.labels" . | nindent 4 }}
{{- with .Values.podDisruptionBudget.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
selector:
matchLabels:
{{- include "fluentd.selectorLabels" . | nindent 6 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/fluentd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,10 @@ ingress:
# - secretName: fluentd-tls
# hosts:
# - fluentd.example.tld


## only available if kind is Deployment or StatefulSet
podDisruptionBudget:
enabled: false
annotations: {}
maxUnavailable: "30%"