Skip to content

Commit

Permalink
Introduce option to enable profiler
Browse files Browse the repository at this point in the history
This can be used to help the 1Password debug memory and performance issues.

If enabled, data can be exported by running:
```
kubectl cp -c profiler-data <pod>:/data profiler
```
  • Loading branch information
jpcoenen committed Jul 14, 2023
1 parent a973f1a commit a218505
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions charts/connect/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,17 @@ Sets extra service annotations
{{- end }}
{{- end }}
{{- end -}}

{{/*
Sets environment variables when profiler is enabled
*/}}
{{- define "onepassword-connect.profilerConfig" -}}
{{- if .Values.connect.profiler.enabled}}
- name: OP_PROFILER_OUTPUT_DIR
value: "/home/opuser/.op/data/profiler"
- name: OP_PROFILER_INTERVAL
value: "{{ .Values.connect.profiler.interval }}"
- name: OP_PROFILER_KEEP_LAST
value: "{{ .Values.connect.profiler.keepLast }}"
{{- end -}}
{{- end -}}
11 changes: 11 additions & 0 deletions charts/connect/templates/connect-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ spec:
{{- end }}
- name: OP_LOG_LEVEL
value: "{{ .Values.connect.api.logLevel }}"
{{- include "onepassword-connect.profilerConfig" . | indent 12 -}}
{{- if .Values.connect.probes.readiness }}
readinessProbe:
httpGet:
Expand Down Expand Up @@ -131,6 +132,7 @@ spec:
value: localhost:11220
- name: OP_LOG_LEVEL
value: "{{ .Values.connect.sync.logLevel }}"
{{- include "onepassword-connect.profilerConfig" . | indent 12 }}
{{- if .Values.connect.probes.readiness }}
readinessProbe:
httpGet:
Expand All @@ -151,4 +153,13 @@ spec:
volumeMounts:
- mountPath: /home/opuser/.op/data
name: {{ .Values.connect.dataVolume.name }}
{{- if .Values.connect.profiler.enabled }}
- name: profiler-data
image: alpine
command: [ 'sleep', 'infinity' ]
volumeMounts:
- name: {{ .Values.connect.dataVolume.name }}
mountPath: /data
subPath: profiler
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/connect/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ connect:
# hosts:
# - chart-example.local

# Optionally the internal profiler can be enabled to debug memory or performance issues.
# For normal operation of Connect this does not have to enabled.
profiler:
enabled: false
# The interval at which profiler snapshots are taken.
interval: 6h
# Number of profiler snapshots to keep.
keepLast: 12

# This section of values is for 1Password Operator Configuration
operator:
# Denotes whether the 1Password Operator will be deployed
Expand Down

0 comments on commit a218505

Please sign in to comment.