diff --git a/.github/ct.yml b/.github/ct.yml index 70fa9d4..189b859 100644 --- a/.github/ct.yml +++ b/.github/ct.yml @@ -1 +1 @@ -check-version-increment: False +check-version-increment: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 800be58..7a3f8a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: fi - name: Run chart-testing (lint) - run: ct lint + run: ct lint --config .github/ct.yml - name: Create kind cluster uses: helm/kind-action@v1 diff --git a/README.md b/README.md index ce256a1..eb90355 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,12 @@ You can then run `helm search repo zipkin` to see the charts. | serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template | | serviceAccount.psp | bool | `false` | | | tolerations | list | `[]` | | -| zipkin.storage.elasticsearch.hosts | string | `"hostA hostB"` | | -| zipkin.storage.elasticsearch.index | string | `"fooIndex"` | | -| zipkin.storage.type | string | `"elasticsearch"` | | +| zipkin.selfTracing.enabled | bool | `false` | | +| zipkin.storage.elasticsearch.hosts | string | no default | | +| zipkin.storage.elasticsearch.index | string | `"zipkin"` | | +| zipkin.storage.type | string | `"mem"` | | The values are validated using a JSON schema, which contains logic to enforce either: - `zipkin.storage.type` is set to `mem` -- `zipkin.storage.type` is set to `elasticsearch` *AND* both `z.s.elasticsearch.hosts` and `z.s.elasticsearch.index` is set +- `zipkin.storage.type` is set to `elasticsearch` *AND* `z.s.elasticsearch.hosts` is set diff --git a/charts/zipkin/ci/elasticsearch-values.yaml b/charts/zipkin/ci/elasticsearch-values.yaml new file mode 100644 index 0000000..e496d88 --- /dev/null +++ b/charts/zipkin/ci/elasticsearch-values.yaml @@ -0,0 +1,13 @@ +--- +zipkin: + storage: + type: elasticsearch + elasticsearch: + hosts: http://localhost:9200 + +# extra containers are in the same pod, so accessible by localhost +extraContainers: + - name: elasticsearch + image: 'ghcr.io/openzipkin/zipkin-elasticsearch8' + ports: + - containerPort: 9200 diff --git a/charts/zipkin/templates/_helpers.tpl b/charts/zipkin/templates/_helpers.tpl index c949954..f1120cb 100644 --- a/charts/zipkin/templates/_helpers.tpl +++ b/charts/zipkin/templates/_helpers.tpl @@ -81,3 +81,14 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Add extra containers to the pod spec +*/}} +{{- define "zipkin.extraContainers" -}} +{{- if .Values.extraContainers }} +{{- with .Values.extraContainers }} +{{- toYaml . | nindent 2 }} +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/zipkin/templates/deployment.yaml b/charts/zipkin/templates/deployment.yaml index b680374..77c7be7 100644 --- a/charts/zipkin/templates/deployment.yaml +++ b/charts/zipkin/templates/deployment.yaml @@ -48,22 +48,32 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" env: + {{- if .Values.zipkin.selfTracing.enabled }} - name: SELF_TRACING_ENABLED - value: "{{ .Values.zipkin.selfTracing.enabled }}" + value: "true" + {{- end }} - name: STORAGE_TYPE value: "{{ .Values.zipkin.storage.type }}" {{- if eq .Values.zipkin.storage.type "elasticsearch" }} {{- with .Values.zipkin.storage.elasticsearch }} - name: ES_HOSTS - value: "{{ .hosts }}" + value: {{ .hosts | quote }} + {{- if .index }} - name: ES_INDEX - value: "{{ .index }}" + value: {{ .index | quote }} + {{- end }} + {{- if .username }} - name: ES_USERNAME - value: "{{ .username }}" + value: {{ .username | quote }} + {{- end }} + {{- if .password }} - name: ES_PASSWORD - value: "{{ .password }}" + value: {{ .password | quote }} + {{- end }} + {{- if .sslNoVerify }} - name: ES_SSL_NO_VERIFY - value: "{{ default false .sslNoVerify }}" + value: "true" + {{- end }} {{- end }} {{- end }} {{- range $key, $value := .Values.zipkin.extraEnv }} @@ -79,6 +89,7 @@ spec: periodSeconds: 5 resources: {{- toYaml .Values.resources | nindent 12 }} + {{- include "zipkin.extraContainers" . | nindent 6 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/zipkin/templates/tests/test-connection.yaml b/charts/zipkin/templates/tests/test-connection.yaml index 0a58192..5b4b881 100644 --- a/charts/zipkin/templates/tests/test-connection.yaml +++ b/charts/zipkin/templates/tests/test-connection.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: diff --git a/charts/zipkin/values.schema.json b/charts/zipkin/values.schema.json index a5a6460..e0ccaaf 100644 --- a/charts/zipkin/values.schema.json +++ b/charts/zipkin/values.schema.json @@ -22,6 +22,19 @@ } } }, + "extraContainers": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true, + "properties": { + "name": { + "type": "string" + } + }, + "required": ["name"] + } + }, "fullnameOverride": { "type": "string" }, @@ -182,7 +195,7 @@ "type": "string" } }, - "required": ["hosts", "index"] + "required": ["hosts"] }, "type": { "enum": ["mem", "elasticsearch"] @@ -203,9 +216,9 @@ } ] }, - "extraEnv": { - "type": "object" - } + "extraEnv": { + "type": "object" + } } } } diff --git a/charts/zipkin/values.yaml b/charts/zipkin/values.yaml index 6f45037..4bd22b6 100644 --- a/charts/zipkin/values.yaml +++ b/charts/zipkin/values.yaml @@ -112,3 +112,6 @@ zipkin: # index: fooIndex extraEnv: {} # JAVA_OPTS: "-Xms128m -Xmx512m -XX:+ExitOnOutOfMemoryError" + +# extra containers to add to the same pod (accessible via localhost) +extraContainers: []