Skip to content

Commit

Permalink
Enforce default CPU resource settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalez committed Oct 20, 2021
1 parent 8dc84e4 commit 51b4a39
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.5 (2021-10-20)

* Enforce default CPU resource settings

## 0.8.4 (2021-10-07)

* Support imgproxy v3.0.0.beta1
Expand Down
2 changes: 1 addition & 1 deletion imgproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
description: A fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security.
name: imgproxy
icon: https://cdn.rawgit.com/imgproxy/imgproxy/master/logo.svg
version: 0.8.4
version: 0.8.5
appVersion: 3.0.0.beta1
keywords:
- imgproxy
Expand Down
16 changes: 16 additions & 0 deletions imgproxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,19 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht
{{- .existingClaim | default .name | print }}
{{- end -}}
{{- end -}}

{{/* Builds the resources claim for the deployment */}}
{{- define "imgproxy.podResources" -}}

{{- $default := dict -}}
{{- with $.Values.resources.deployment.replicas | default dict -}}
{{- $minCount := .minCount | default 1 | int }}
{{- $maxCount := .maxCount | default $minCount | int }}
{{- if gt $maxCount $minCount -}}
{{- $default = dict "requests" (dict "cpu" 1) "limits" (dict "cpu" 1) -}}
{{- end -}}
{{- end -}}

{{- $custom := $.Values.resources.deployment.resources | default dict -}}
{{- merge $custom $default | toYaml -}}
{{- end -}}
4 changes: 1 addition & 3 deletions imgproxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ spec:
- secretRef:
name: {{ $secretName }}
{{- end }}
{{- if .Values.resources.deployment.resources }}
resources: {{ .Values.resources.deployment.resources | toYaml | nindent 16 }}
{{- end }}
resources: {{ include "imgproxy.podResources" $ | nindent 12 }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- name: data
Expand Down
3 changes: 2 additions & 1 deletion imgproxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ resources:
# Toleration for K8s taints
tolerations: []

# Set kubernetes specific resource limits
# Set kubernetes specific resource limits.
# We claim `cpu: 1` for both limits and requests by default.
resources: {}
# limits:
# cpu: 700m
Expand Down

0 comments on commit 51b4a39

Please sign in to comment.