Skip to content
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

Fix breaks when mongodb subchart is not used #291

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/litmus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "2.14.0"
description: A Helm chart to install ChaosCenter
name: litmus
version: 2.15.10
version: 2.15.11
kubeVersion: ">=1.16.0-0"
home: https://litmuschaos.io
sources:
Expand Down
2 changes: 1 addition & 1 deletion charts/litmus/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# litmus

![Version: 2.15.10](https://img.shields.io/badge/Version-2.15.10-informational?style=flat-square) ![AppVersion: 2.14.0](https://img.shields.io/badge/AppVersion-2.14.0-informational?style=flat-square)
![Version: 2.15.11](https://img.shields.io/badge/Version-2.15.11-informational?style=flat-square) ![AppVersion: 2.14.0](https://img.shields.io/badge/AppVersion-2.14.0-informational?style=flat-square)

A Helm chart to install ChaosCenter

Expand Down
10 changes: 7 additions & 3 deletions charts/litmus/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ Check for existing secret
{{- end -}}

{{- define "litmus-portal.mongodbServiceName" -}}
{{- if not (eq .Values.mongodb.architecture "replicaset") }}
{{- include "mongodb.fullname" .Subcharts.mongodb -}}
{{- if not .Values.mongodb.enabled }}
{{- .Values.adminConfig.DB_SERVER -}}
{{ else }}
{{- include "mongodb.service.nameOverride" .Subcharts.mongodb -}}
{{- if not (eq .Values.mongodb.architecture "replicaset") }}
{{- include "mongodb.fullname" .Subcharts.mongodb -}}
{{ else }}
{{- include "mongodb.service.nameOverride" .Subcharts.mongodb -}}
{{- end -}}
{{- end -}}
{{- end -}}
4 changes: 4 additions & 0 deletions charts/litmus/templates/auth-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ spec:
command: ["/bin/sh", "-c"]
args:
[
{{- if .Values.mongodb.enabled }}
"while [[ $(curl -sw '%{http_code}' http://{{ include "litmus-portal.mongodbServiceName" . }}:{{ .Values.mongodb.service.ports.mongodb }} -o /dev/null) -ne 200 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'",
Copy link
Member

Choose a reason for hiding this comment

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

Can we calculate port the same way as we do with name? just move this logic to template and include the result.

{{- else }}
"while [[ $(curl -sw '%{http_code}' http://{{ include "litmus-portal.mongodbServiceName" . }}:{{ .Values.adminConfig.DB_PORT }} -o /dev/null) -ne 200 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'",
{{- end }}
]
resources:
{{- toYaml .Values.portal.server.waitForMongodb.resources | nindent 12 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/litmus/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ spec:
command: ["/bin/sh", "-c"]
args:
[
{{- if .Values.mongodb.enabled }}
"while [[ $(curl -sw '%{http_code}' http://{{ include "litmus-portal.mongodbServiceName" . }}:{{ .Values.mongodb.service.ports.mongodb }} -o /dev/null) -ne 200 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'",
{{- else }}
"while [[ $(curl -sw '%{http_code}' http://{{ include "litmus-portal.mongodbServiceName" . }}:{{ .Values.adminConfig.DB_PORT }} -o /dev/null) -ne 200 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'",
Copy link
Member

Choose a reason for hiding this comment

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

the same goes here.

{{- end }}
]
resources:
{{- toYaml .Values.portal.server.waitForMongodb.resources | nindent 12 }}
Expand Down