Skip to content

Commit

Permalink
Add env options (#247)
Browse files Browse the repository at this point in the history
* Add GOMEMLIMIT by default

* Add GOMEMLIMIT by default, allow user to configure additional env variables on the deployment

Signed-off-by: Rafael da Fonseca <[email protected]>

---------

Signed-off-by: Rafael da Fonseca <[email protected]>
Co-authored-by: Vishal Choudhary <[email protected]>
  • Loading branch information
rsafonseca and vishal-chdhry authored Feb 7, 2025
1 parent a1dda07 commit 9feb2a3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions charts/reports-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ helm install reports-server --namespace reports-server --create-namespace report
| serviceAccount.name | string | `""` | Service account name (required if `serviceAccount.create` is `false`) |
| podAnnotations | object | `{}` | Pod annotations |
| podSecurityContext | object | `{"fsGroup":2000}` | Pod security context |
| podEnv | object | `{}` | Provide additional environment variables to the pods. Map with the same format as kubernetes deployment spec's env. |
| securityContext | object | See [values.yaml](values.yaml) | Container security context |
| livenessProbe | object | `{"failureThreshold":10,"httpGet":{"path":"/livez","port":"https","scheme":"HTTPS"},"initialDelaySeconds":20,"periodSeconds":10}` | Liveness probe |
| readinessProbe | object | `{"failureThreshold":10,"httpGet":{"path":"/readyz","port":"https","scheme":"HTTPS"},"initialDelaySeconds":30,"periodSeconds":10}` | Readiness probe |
Expand Down
11 changes: 10 additions & 1 deletion charts/reports-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $env := .Values.podEnv }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -59,8 +60,16 @@ spec:
{{- if .Values.metrics.enabled }}
- --authorization-always-allow-paths=/metrics
{{- end }}
{{- if .Values.config.db.secretName }}
env:
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
divisor: '1'
{{- with $env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.config.db.secretName }}
- name: DB_HOST
valueFrom:
secretKeyRef:
Expand Down
3 changes: 3 additions & 0 deletions charts/reports-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ podAnnotations: {}
podSecurityContext:
fsGroup: 2000

# -- Provide additional environment variables to the pods. Map with the same format as kubernetes deployment spec's env.
podEnv: {}

# -- Container security context
# @default -- See [values.yaml](values.yaml)
securityContext:
Expand Down
6 changes: 6 additions & 0 deletions config/install-etcd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ spec:
- --cert-dir=/tmp
- --secure-port=4443
- --authorization-always-allow-paths=/metrics
env:
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
divisor: '1'
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
6 changes: 6 additions & 0 deletions config/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ spec:
- --cert-dir=/tmp
- --secure-port=4443
- --authorization-always-allow-paths=/metrics
env:
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
divisor: '1'
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down

0 comments on commit 9feb2a3

Please sign in to comment.