From c766beb17b573050a65ebd68c43c8ad73c3ded70 Mon Sep 17 00:00:00 2001 From: Mehul Date: Tue, 1 Oct 2024 15:49:30 +0000 Subject: [PATCH] added all-in-one deployment and configmap for jaeger-v2 Signed-off-by: Mehul lint fix Signed-off-by: Mehul fixed Signed-off-by: Mehul lint fix Signed-off-by: Mehul lint fix Signed-off-by: Mehul fixed using pre-hook Signed-off-by: Mehul fixed --config flag is not been passed Signed-off-by: mehul release ns for config-map.yaml Signed-off-by: mehul testing ci Signed-off-by: mehul testing ci Signed-off-by: mehul fixed ns Signed-off-by: mehul fixed ns Signed-off-by: mehul fixed template Signed-off-by: mehul removed sampling Signed-off-by: mehul removed adaptive sampling from processors Signed-off-by: mehul Revert "Jaeger v2 test2" fixed hostname for es provisionDataStore.elasticsearch and added ci test for it Signed-off-by: mehul version bump Signed-off-by: mehul fix ci Signed-off-by: mehul added client url Signed-off-by: mehul fixed pod init Signed-off-by: mehul added https code check Signed-off-by: mehul --- .github/workflows/es.yaml | 78 +++++++++++++++++++ charts/jaeger/Chart.yaml | 2 +- charts/jaeger/templates/_helpers.tpl | 6 +- charts/jaeger/templates/collector-deploy.yaml | 14 ++++ charts/jaeger/templates/query-deploy.yaml | 21 ++++- 5 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/es.yaml diff --git a/.github/workflows/es.yaml b/.github/workflows/es.yaml new file mode 100644 index 00000000..e06873a7 --- /dev/null +++ b/.github/workflows/es.yaml @@ -0,0 +1,78 @@ +name: es Charts + +on: pull_request + +jobs: + elasticsearch-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: v3.14.4 + + # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and + # yamllint (https://github.com/adrienverge/yamllint) which require Python + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + with: + version: v3.10.1 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --config ct.yaml) + if [[ -n "$changed" ]]; then + echo "::set-output name=changed::true" + fi + - name: Run chart-testing (lint) + run: ct lint --config ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + if: steps.list-changed.outputs.changed == 'true' + + - name: Install kubectl + uses: azure/setup-kubectl@v4.0.0 + with: + version: 'v1.28.8' + id: install + + - name: Set up cert-manager + run: | + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml --namespace ingress-nginx + kubectl label node --all ingress-ready=true + kubectl describe pod --selector=app.kubernetes.io/component=controller -n ingress-nginx + kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=5m + kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml + - name: Set up cmctl + run: | + curl -sSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/v1.6.1/cmctl-linux-amd64.tar.gz + tar xzf cmctl.tar.gz + sudo mv cmctl /usr/local/bin + cmctl version + - name: Check if cert-manager is up + run: | + cmctl check api --wait=5m + - name: Run 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..f6f6b13f 100644 --- a/charts/jaeger/templates/_helpers.tpl +++ b/charts/jaeger/templates/_helpers.tpl @@ -268,7 +268,11 @@ 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 }} +{{- printf "%s://%s:%s" .Values.storage.elasticsearch.scheme $host $port }} {{- end -}} {{- define "jaeger.hotrod.tracing.host" -}} diff --git a/charts/jaeger/templates/collector-deploy.yaml b/charts/jaeger/templates/collector-deploy.yaml index dfdd1dc7..4a351479 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..c3cfd7e1 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: