Skip to content

Commit

Permalink
Further review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
d-venkat committed May 21, 2024
1 parent 4ecc9de commit 9853e15
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 deletions.
30 changes: 15 additions & 15 deletions templates/_resources.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ These presets are for basic testing and not meant to be used in production
{{ include "release.resources.preset" (dict "type" "nano") -}}
*/}}
{{- define "release.resources.preset" -}}
{{/* The limits are the requests increased by 50% (except ephemeral-storage and xlarge/2xlarge sizes)*/}}
{{/* The limits are as per the documentation. The requests are limits reduced by approximately 150% and rounded.*/}}
{{- $presets := dict
"nano" (dict
"requests" (dict "cpu" "1.0" "memory" "2Gi")
"limits" (dict "cpu" "1.5" "memory" "3Gi")
"requests" (dict "cpu" "500m" "memory" "1Gi")
"limits" (dict "cpu" "1.0" "memory" "2Gi")
)
"micro" (dict
"requests" (dict "cpu" "2.0" "memory" "4Gi")
"limits" (dict "cpu" "3.0" "memory" "6Gi")
"requests" (dict "cpu" "1.0" "memory" "2Gi")
"limits" (dict "cpu" "2.0" "memory" "4Gi")
)
"small" (dict
"requests" (dict "cpu" "4.0" "memory" "8Gi")
"limits" (dict "cpu" "6.0" "memory" "12Gi")
"requests" (dict "cpu" "2.0" "memory" "5Gi")
"limits" (dict "cpu" "4.0" "memory" "8Gi")
)
"medium" (dict
"requests" (dict "cpu" "8.0" "memory" "16Gi")
"limits" (dict "cpu" "12.0" "memory" "24Gi")
"requests" (dict "cpu" "5.0" "memory" "10Gi")
"limits" (dict "cpu" "8.0" "memory" "16Gi")
)
"large" (dict
"requests" (dict "cpu" "16.0" "memory" "32Gi")
"limits" (dict "cpu" "24.0" "memory" "48Gi")
"requests" (dict "cpu" "10.0" "memory" "21Gi")
"limits" (dict "cpu" "16.0" "memory" "32Gi")
)
"xlarge" (dict
"requests" (dict "cpu" "32" "memory" "64Gi")
"limits" (dict "cpu" "64" "memory" "96Gi")
"requests" (dict "cpu" "21.0" "memory" "42Gi")
"limits" (dict "cpu" "32.0" "memory" "64Gi")
)
"2xlarge" (dict
"requests" (dict "cpu" "64" "memory" "128Gi")
"limits" (dict "cpu" "128" "memory" "256Gi")
"requests" (dict "cpu" "42.0" "memory" "85Gi")
"limits" (dict "cpu" "64.0" "memory" "128Gi")
)
}}
{{- if hasKey $presets .type -}}
Expand Down
10 changes: 6 additions & 4 deletions templates/release-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ spec:
value: {{ include "postgresql.subchart" . }}
- name: POSTGRESQL_PORT
value: {{ (include "release.postgresql.service.port" .) | quote }}
resources: {{- include "common.resources.preset" (dict "type" "nano") | nindent 12 }}
{{- if .Values.defaultInitContainers.resources }}
resources: {{- toYaml .Values.defaultInitContainers.resources | nindent 12 }}
{{- end }}
{{- end }}
{{- if and (not .Values.external.mq.enabled) .Values.rabbitmq.install }}
- name: wait-for-rabbitmq
Expand All @@ -121,7 +123,9 @@ spec:
value: {{ include "rabbitmq.subchart" . }}
- name: RABBITMQ_PORT
value: {{ .Values.rabbitmq.service.ports.amqp | quote }}
resources: {{- include "common.resources.preset" (dict "type" "nano") | nindent 12 }}
{{- if .Values.defaultInitContainers.resources }}
resources: {{- toYaml .Values.defaultInitContainers.resources | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
Expand All @@ -137,8 +141,6 @@ spec:
securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- else }}
resources: {{- include "common.resources.preset" (dict "type" "nano") | nindent 12 }}
{{- end }}
volumeMounts:
{{- range $path := .Values.persistence.paths }}
Expand Down
31 changes: 21 additions & 10 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,17 @@ health:
probesLivenessTimeout: 60
probesReadinessTimeout: 60

## @param defaultInitContainers Default init containers for the Release pod
defaultInitContainers:
## @param defaultInitContainers.resources Set default init container requests and limits for different resources like CPU or memory (essential for production workloads)
##
resources:
limits:
cpu: 150m
memory: 192Mi
requests:
cpu: 100m
memory: 128Mi
## @param initContainers Add init containers to the Release pod
## Example:
## initContainers:
Expand All @@ -1319,6 +1330,7 @@ health:
## ports:
## - name: portname
## containerPort: 1234
## resources: {}
##
initContainers: []
## @param sidecars Add sidecar containers to the Release pod
Expand All @@ -1330,6 +1342,7 @@ initContainers: []
## ports:
## - name: portname
## containerPort: 1234
## resources: {}
##
sidecars: []

Expand Down Expand Up @@ -1379,16 +1392,14 @@ volumePermissions:
## @param volumePermissions.resources Set container requests and limits for different resources like CPU or memory (essential for production workloads)
## @param volumePermissions.resources.limits Init container volume-permissions resource limits
## @param volumePermissions.resources.requests Init container volume-permissions resource requests
## Example:
## resources:
## limits:
## cpu: 100m
## memory: 128Mi
## requests:
## cpu: 100m
## memory: 128Mi
##
resources: {}
##
resources:
limits:
cpu: 150m
memory: 192Mi
requests:
cpu: 100m
memory: 128Mi
## Init container' Security Context
## Note: the chown of the data folder is done to containerSecurityContext.runAsUser
## and not the below volumePermissions.containerSecurityContext.runAsUser
Expand Down

0 comments on commit 9853e15

Please sign in to comment.