Skip to content

Commit

Permalink
Fix hostname for Elasticsearch and add CI test
Browse files Browse the repository at this point in the history
Signed-off-by: mehul <mehulsharma4786@gmail.com>
  • Loading branch information
mehul authored and hellspawn679 committed Nov 2, 2024
1 parent 1db9b63 commit 25da2bd
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 5 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,38 @@ jobs:

- name: Run chart-testing (install)
run: ct install --config ct.yaml
test-with-allInOne:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: ./.github/actions/prepare-k8s
run: |
ct install --config ct.yaml --helm-extra-set-args "
--set provisionDataStore.cassandra=false
--set storage.type=memory
--set allInOne.enabled=true
--set agent.enabled=false
--set collector.enabled=false
--set query.enabled=false"
test-with-elasticsearch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/prepare-k8s

- name: Run elasticsearch-chart-testing (install)
run: |
ct install --config ct.yaml --helm-extra-set-args "
--set provisionDataStore.cassandra=false
--set provisionDataStore.elasticsearch=true
--set storage.type=elasticsearch
--set elasticsearch.master.masterOnly=false
--set elasticsearch.master.replicaCount=1
--set elasticsearch.data.replicaCount=0
--set elasticsearch.coordinating.replicaCount=0
--set elasticsearch.ingest.replicaCount=0"
2 changes: 1 addition & 1 deletion charts/jaeger/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 1.53.0
description: A Jaeger Helm chart for Kubernetes
name: jaeger
type: application
version: 3.3.1
version: 3.3.2
# CronJobs require v1.21
kubeVersion: ">= 1.21-0"
keywords:
Expand Down
5 changes: 4 additions & 1 deletion charts/jaeger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
*/}}
{{- define "elasticsearch.client.url" -}}
{{- $port := .Values.storage.elasticsearch.port | toString -}}
{{- printf "%s://%s:%s" .Values.storage.elasticsearch.scheme .Values.storage.elasticsearch.host $port }}
{{- $host := .Values.storage.elasticsearch.host }}
{{- if .Values.provisionDataStore.elasticsearch }}
{{- $host = printf "%s-elasticsearch" .Release.Name }}
{{- end }}
{{- end -}}

{{- define "jaeger.hotrod.tracing.host" -}}
Expand Down
14 changes: 14 additions & 0 deletions charts/jaeger/templates/collector-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ spec:
{{- toYaml .Values.collector.podLabels | nindent 8 }}
{{- end }}
spec:
{{- if .Values.provisionDataStore.elasticsearch }}
initContainers:
- name: elasticsearch-checker
image: curlimages/curl
command:
- sh
- "-c"
- |
url="{{ include "elasticsearch.client.url" . }}"
until [ "$(curl -s -o /dev/null -w '%{http_code}' "$url/_cluster/health")" = "200" ]; do
echo "Waiting for Elasticsearch at $url"
sleep 5
done
{{- end}}
{{- with .Values.collector.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
Expand Down
21 changes: 18 additions & 3 deletions charts/jaeger/templates/query-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,25 @@ spec:
{{- toYaml .Values.query.podSecurityContext | nindent 8 }}
serviceAccountName: {{ template "jaeger.query.serviceAccountName" . }}
{{- include "query.imagePullSecrets" . | nindent 6 }}
{{- if .Values.query.initContainers }}
{{- if or .Values.query.initContainers .Values.provisionDataStore.elasticsearch }}
initContainers:
{{- toYaml .Values.query.initContainers | nindent 8 }}
{{- end}}
{{- if .Values.query.initContainers }}
{{- toYaml .Values.query.initContainers | nindent 8 }}
{{- end }}
{{- if .Values.provisionDataStore.elasticsearch }}
- name: elasticsearch-checker
image: curlimages/curl
command:
- sh
- "-c"
- |
url="{{ include "elasticsearch.client.url" . }}"
until [ "$(curl -s -o /dev/null -w '%{http_code}' "$url/_cluster/health")" = "200" ]; do
echo "waiting for Elasticsearch at $url"
sleep 5
done
{{- end }}
{{- end }}
containers:
- name: {{ template "jaeger.query.name" . }}
securityContext:
Expand Down

0 comments on commit 25da2bd

Please sign in to comment.