diff --git a/charts/connect/templates/_helpers.tpl b/charts/connect/templates/_helpers.tpl index 2c1bc0d..9488dd6 100644 --- a/charts/connect/templates/_helpers.tpl +++ b/charts/connect/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/connect/templates/connect-deployment.yaml b/charts/connect/templates/connect-deployment.yaml index 878df1f..cf4057a 100644 --- a/charts/connect/templates/connect-deployment.yaml +++ b/charts/connect/templates/connect-deployment.yaml @@ -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: @@ -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: @@ -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 }} diff --git a/charts/connect/values.yaml b/charts/connect/values.yaml index 40256c6..5d8849c 100644 --- a/charts/connect/values.yaml +++ b/charts/connect/values.yaml @@ -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