diff --git a/charts/clusterpedia-core/templates/_helpers.tpl b/charts/clusterpedia-core/templates/_helpers.tpl index 86b9758..10bf81a 100644 --- a/charts/clusterpedia-core/templates/_helpers.tpl +++ b/charts/clusterpedia-core/templates/_helpers.tpl @@ -176,6 +176,29 @@ env: - name: STORAGE_PLUGINS value: /var/lib/clusterpedia/plugins {{- end }} +{{- if .Values.telemetry.tracing.enabled }} +- name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ .Values.telemetry.tracing.addr }} +- name: 'OTEL_SERVICE_NAME' + value: {{ include "common.names.fullname" . }}-apiserver +- name: 'OTEL_K8S_NAMESPACE' + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace +- name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName +- name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name +- name: OTEL_RESOURCE_ATTRIBUTES + value: 'k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME)' +{{- end -}} {{- if .Values.apiserver.enableSHA1Cert }} - name: GODEBUG value: x509sha1=1 diff --git a/charts/clusterpedia-core/values.yaml b/charts/clusterpedia-core/values.yaml index 89f6294..a010218 100644 --- a/charts/clusterpedia-core/values.yaml +++ b/charts/clusterpedia-core/values.yaml @@ -20,6 +20,12 @@ commonLabels: {} ## @param commonAnnotations Annotations to add to all deployed objects ## commonAnnotations: {} +## @param telemetry define flag whether to enable otel trace +## +telemetry: + tracing: + enabled: false + addr: "" ## clusterpedia apiserver config apiserver: diff --git a/charts/clusterpedia/Chart.yaml b/charts/clusterpedia/Chart.yaml index 2a4ed14..3c97e93 100644 --- a/charts/clusterpedia/Chart.yaml +++ b/charts/clusterpedia/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 2.0.0 +version: 2.0.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/clusterpedia/README.md b/charts/clusterpedia/README.md index 6bd24e2..6aa56bc 100644 --- a/charts/clusterpedia/README.md +++ b/charts/clusterpedia/README.md @@ -187,6 +187,8 @@ rm /var/local/clusterpedia/internalstorage/<storage type> | postgresql.primary.persistence.enabled | bool | `true` | | | postgresql.primary.persistence.size | string | `"10Gi"` | | | storageInstallMode | string | `"internal"` | | +| telemetry.tracing.addr | string | `""` | | +| telemetry.tracing.enabled | bool | `false` | | ### StorageConfig @@ -248,6 +250,7 @@ rm /var/local/clusterpedia/internalstorage/<storage type> | clustersynchroManager.image.registry | string | `"ghcr.io"` | | | clustersynchroManager.image.repository | string | `"clusterpedia-io/clusterpedia/clustersynchro-manager"` | | | clustersynchroManager.image.tag | string | `"v0.7.0"` | | +| clustersynchroManager.kubeStateMetrics.enabled | bool | `false` | | | clustersynchroManager.labels | object | `{}` | | | clustersynchroManager.leaderElect.leaseDuration | string | `"15s"` | | | clustersynchroManager.leaderElect.renewDeadline | string | `"10s"` | | @@ -281,4 +284,4 @@ rm /var/local/clusterpedia/internalstorage/<storage type> | controllerManager.tolerations | list | `[]` | | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) \ No newline at end of file +Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) diff --git a/charts/clusterpedia/templates/_helpers.tpl b/charts/clusterpedia/templates/_helpers.tpl index 767ab8d..2055373 100644 --- a/charts/clusterpedia/templates/_helpers.tpl +++ b/charts/clusterpedia/templates/_helpers.tpl @@ -361,3 +361,29 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- define "clusterpedia.hookJob.image" -}} {{ include "common.images.image" (dict "imageRoot" .Values.hookJob.image "global" .Values.global) }} {{- end -}} + +{{- define "clusterpedia.tracing.env" -}} +{{- if .Values.telemetry.tracing.enabled }} +- name: OTEL_EXPORTER_OTLP_ENDPOINT + value: {{ .Values.telemetry.tracing.addr }} +- name: 'OTEL_SERVICE_NAME' + value: {{ include "common.names.fullname" . }}-apiserver +- name: 'OTEL_K8S_NAMESPACE' + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace +- name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName +- name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name +- name: OTEL_RESOURCE_ATTRIBUTES + value: 'k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME)' +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/clusterpedia/templates/apiserver-deployment.yaml b/charts/clusterpedia/templates/apiserver-deployment.yaml index 20592f8..aa67abe 100644 --- a/charts/clusterpedia/templates/apiserver-deployment.yaml +++ b/charts/clusterpedia/templates/apiserver-deployment.yaml @@ -132,6 +132,7 @@ spec: secretKeyRef: name: {{ include "clusterpedia.internalstorage.fullname" . }} key: password + {{- include "clusterpedia.tracing.env" . | nindent 8 }} {{- if .Values.apiserver.enableSHA1Cert }} - name: GODEBUG value: netdns=go,x509sha1=1 diff --git a/charts/clusterpedia/values.yaml b/charts/clusterpedia/values.yaml index 5cca9c7..2eee1a5 100644 --- a/charts/clusterpedia/values.yaml +++ b/charts/clusterpedia/values.yaml @@ -41,6 +41,12 @@ commonAnnotations: {} ## if PV resources are not required, set it to None! ## if defined, will create the pv on the node. persistenceMatchNode: "" +## @param telemetry define flag whether to enable otel trace +## +telemetry: + tracing: + enabled: false + addr: "" ## @param storageConfig StorageConfig for the apiserver and clustersynchro manger ##