Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
name: pgdog
version: v0.54
version: v0.55
appVersion: "0.1.37"
23 changes: 23 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,26 @@ as scientific notation (e.g. 8.64e+07). TOML rejects this.
{{- define "pgdog.intval" -}}
{{- if kindIs "string" . -}}{{ . }}{{- else -}}{{ int64 . }}{{- end -}}
{{- end -}}

{{/*
Render a resources block, omitting CPU limits when noCpuLimits is true.
Call as: include "pgdog.resources" (dict "resources" .Values.resources "noCpuLimits" .Values.noCpuLimits)
*/}}
{{- define "pgdog.resources" -}}
{{- $res := .resources -}}
{{- if $res -}}
resources:
{{- if $res.requests }}
requests:
{{- toYaml $res.requests | nindent 4 }}
{{- end }}
{{- $limits := $res.limits }}
{{- if and .noCpuLimits $limits }}
{{- $limits = omit $limits "cpu" }}
{{- end }}
{{- if $limits }}
limits:
{{- toYaml $limits | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
10 changes: 2 additions & 8 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ spec:
sleep:
seconds: {{ .Values.preStopSleepSeconds }}
{{- end }}
{{- if .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- include "pgdog.resources" (dict "resources" .Values.resources "noCpuLimits" .Values.noCpuLimits) | nindent 10 }}
{{- if .Values.livenessProbe }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
Expand Down Expand Up @@ -171,10 +168,7 @@ spec:
ports:
- name: prom
containerPort: {{ .Values.prometheusPort }}
{{- if .Values.prometheusResources }}
resources:
{{- toYaml .Values.prometheusResources | nindent 12 }}
{{- end }}
{{- include "pgdog.resources" (dict "resources" .Values.prometheusResources "noCpuLimits" .Values.noCpuLimits) | nindent 10 }}
volumeMounts:
- name: prom
mountPath: /etc/prom
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ extraVolumes: []
# mountPath: /pki
extraVolumeMounts: []

# noCpuLimits removes CPU limits from containers so they can use idle CPU on the host.
# Memory limits are still applied. CPU requests are preserved for scheduling.
noCpuLimits: false

# resources define resource requests and limits for the pgdog container
# Note: requests and limits are set to the same values for Guaranteed QoS
# Ratio: 1GB memory per 1 CPU (1000m CPU = 1Gi memory)
Expand Down