Skip to content

Commit

Permalink
add OTEL trace env for helm chart
Browse files Browse the repository at this point in the history
Signed-off-by: KubeKyrie <[email protected]>
  • Loading branch information
KubeKyrie committed Nov 27, 2023
1 parent d65f4a3 commit 11098f9
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 2 deletions.
23 changes: 23 additions & 0 deletions charts/clusterpedia-core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions charts/clusterpedia-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion charts/clusterpedia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion charts/clusterpedia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"` | |
Expand Down Expand Up @@ -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)
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)
26 changes: 26 additions & 0 deletions charts/clusterpedia/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
1 change: 1 addition & 0 deletions charts/clusterpedia/templates/apiserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions charts/clusterpedia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
##
Expand Down

0 comments on commit 11098f9

Please sign in to comment.