Skip to content

DEVOPS-2991-fixed-make-async-profiler-init-container-failures-non-blocking #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
26 changes: 20 additions & 6 deletions chart/templates/backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,26 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
command: ["/usr/lib/jvm/default-jvm/bin/java"]
args: [{{ if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}"-Djavax.net.ssl.trustStore=/p12/internalca", "-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)",{{ end }}
{{- include "lightrun-backend.java.argument.asyncProfiler" . | nindent 12 }}
"-jar",
"/usr/src/lightrun/{{ .Values.deployments.backend.jar_name }}"
]
command: ["sh", "-c"]
args:
- |
if [ -f /async-profiler-download-status/download-failed ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to remove duplicate code.
you can construct the command and append the async profiler args if needed

echo "async-profiler setup failed earlier, starting without it"
exec /usr/lib/jvm/default-jvm/bin/java \
{{- if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}
"-Djavax.net.ssl.trustStore=/p12/internalca" \
"-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)" \
{{- end }}
"-jar" "/usr/src/lightrun/{{ .Values.deployments.backend.jar_name }}"
else
exec /usr/lib/jvm/default-jvm/bin/java \
{{- if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}
"-Djavax.net.ssl.trustStore=/p12/internalca" \
"-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)" \
{{- end }}
{{- include "lightrun-backend.java.argument.asyncProfiler" . | nindent 16 }} \
"-jar" "/usr/src/lightrun/{{ .Values.deployments.backend.jar_name }}"
fi
volumeMounts:
{{- include "lightrun-backend-crons.volumeMounts" . | nindent 12 }}
{{- include "lightrun-backend.volumeMounts.asyncProfiler" . | nindent 12 }}
Expand Down
30 changes: 20 additions & 10 deletions chart/templates/crons/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,26 @@ spec:
- name: http
containerPort: 8080
protocol: TCP
command: ["/usr/lib/jvm/default-jvm/bin/java"]
args: [
{{- if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}
"-Djavax.net.ssl.trustStore=/p12/internalca",
"-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)",
{{- end }}
{{- include "lightrun-crons.java.argument.asyncProfiler" . | nindent 12 }}
"-jar",
"/usr/src/lightrun/{{ .Values.deployments.crons.jar_name }}"
]
command: ["sh", "-c"]
args:
- |
if [ -f /async-profiler-download-status/download-failed ]; then
echo "async-profiler setup failed earlier, starting without it"
exec /usr/lib/jvm/default-jvm/bin/java \
{{- if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}
"-Djavax.net.ssl.trustStore=/p12/internalca" \
"-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)" \
{{- end }}
"-jar" "/usr/src/lightrun/{{ .Values.deployments.crons.jar_name }}"
else
exec /usr/lib/jvm/default-jvm/bin/java \
{{- if and .Values.general.internal_tls.enabled .Values.general.internal_tls.certificates.existing_ca_secret_name }}
"-Djavax.net.ssl.trustStore=/p12/internalca" \
"-Djavax.net.ssl.trustStorePassword=$(KEYSTORE_PASSWORD)" \
{{- end }}
{{- include "lightrun-crons.java.argument.asyncProfiler" . | nindent 16 }}
"-jar" "/usr/src/lightrun/{{ .Values.deployments.crons.jar_name }}"
fi
volumeMounts:
{{- include "lightrun-backend-crons.volumeMounts" . | nindent 12 }}
{{- include "lightrun-crons.volumeMounts.asyncProfiler" . | nindent 12 }}
Expand Down
12 changes: 11 additions & 1 deletion chart/templates/helpers/_asyncProfiler.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
- |
set -ex
cd /tmp
wget {{ .downloadUrl }} -O async-profiler.tar.gz
if ! wget "{{ .downloadUrl }}" -O async-profiler.tar.gz; then
touch /async-profiler-download-status/download-failed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a new file? can't we just check if the async profiler binary exists in the container?

exit 0
fi
tar xvf async-profiler.tar.gz
cp -r async-profiler-*/* /async-profiler
resources:
Expand All @@ -21,6 +24,8 @@
volumeMounts:
- name: async-profiler-download
mountPath: /async-profiler
- name: async-profiler-download-status
mountPath: /async-profiler-download-status
{{- end -}}


Expand Down Expand Up @@ -90,6 +95,9 @@
- name: async-profiler-download
emptyDir:
sizeLimit: 50Mi
- name: async-profiler-download-status
emptyDir:
sizeLimit: 10Mi
{{- end -}}


Expand All @@ -98,6 +106,8 @@
mountPath: /async-profiler-tmp
- name: async-profiler-download
mountPath: /async-profiler
- name: async-profiler-download-status
mountPath: /async-profiler-download-status
{{- end -}}


Expand Down