From 25da2bdb0f08104e3da492542676dddc791d7496 Mon Sep 17 00:00:00 2001 From: mehul Date: Sun, 3 Nov 2024 00:59:42 +0530 Subject: [PATCH 1/3] Fix hostname for Elasticsearch and add CI test Signed-off-by: mehul --- .github/workflows/lint-test.yaml | 35 +++++++++++++++++++ charts/jaeger/Chart.yaml | 2 +- charts/jaeger/templates/_helpers.tpl | 5 ++- charts/jaeger/templates/collector-deploy.yaml | 14 ++++++++ charts/jaeger/templates/query-deploy.yaml | 21 +++++++++-- 5 files changed, 72 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index a4014005..9d7296df 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -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" \ No newline at end of file diff --git a/charts/jaeger/Chart.yaml b/charts/jaeger/Chart.yaml index 7b103ab6..be86e1c2 100644 --- a/charts/jaeger/Chart.yaml +++ b/charts/jaeger/Chart.yaml @@ -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: diff --git a/charts/jaeger/templates/_helpers.tpl b/charts/jaeger/templates/_helpers.tpl index f4db73be..4a3b0d6c 100644 --- a/charts/jaeger/templates/_helpers.tpl +++ b/charts/jaeger/templates/_helpers.tpl @@ -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" -}} diff --git a/charts/jaeger/templates/collector-deploy.yaml b/charts/jaeger/templates/collector-deploy.yaml index dfdd1dc7..86e15ed8 100644 --- a/charts/jaeger/templates/collector-deploy.yaml +++ b/charts/jaeger/templates/collector-deploy.yaml @@ -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 }} diff --git a/charts/jaeger/templates/query-deploy.yaml b/charts/jaeger/templates/query-deploy.yaml index da8f1aa1..dc6ece41 100644 --- a/charts/jaeger/templates/query-deploy.yaml +++ b/charts/jaeger/templates/query-deploy.yaml @@ -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: From 682557c95d5c7a84a8c9c1f28edd6c1a60b59fcd Mon Sep 17 00:00:00 2001 From: mehul Date: Sun, 3 Nov 2024 01:56:50 +0530 Subject: [PATCH 2/3] fixed the ci Signed-off-by: mehul --- .github/workflows/lint-test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 9d7296df..4b7b2b25 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -47,7 +47,7 @@ jobs: - uses: ./.github/actions/prepare-k8s - - name: Run chart-testing (install) + - name: Run cassandra-chart-testing (install) run: ct install --config ct.yaml test-with-allInOne: runs-on: ubuntu-latest @@ -57,6 +57,8 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare-k8s + + - name: Run allInOne-chart-testing (install) run: | ct install --config ct.yaml --helm-extra-set-args " --set provisionDataStore.cassandra=false @@ -71,6 +73,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - uses: ./.github/actions/prepare-k8s - name: Run elasticsearch-chart-testing (install) From 90086264e58e94e18a01cc676ef760576d99a812 Mon Sep 17 00:00:00 2001 From: mehul Date: Sun, 3 Nov 2024 02:43:24 +0530 Subject: [PATCH 3/3] fixed es Signed-off-by: mehul --- charts/jaeger/templates/_helpers.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/jaeger/templates/_helpers.tpl b/charts/jaeger/templates/_helpers.tpl index 4a3b0d6c..f6f6b13f 100644 --- a/charts/jaeger/templates/_helpers.tpl +++ b/charts/jaeger/templates/_helpers.tpl @@ -272,6 +272,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- if .Values.provisionDataStore.elasticsearch }} {{- $host = printf "%s-elasticsearch" .Release.Name }} {{- end }} +{{- printf "%s://%s:%s" .Values.storage.elasticsearch.scheme $host $port }} {{- end -}} {{- define "jaeger.hotrod.tracing.host" -}}