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 Dec 26, 2023
1 parent e5899c5 commit d7d2be0
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 5 deletions.
93 changes: 93 additions & 0 deletions charts/clusterpedia-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# clusterpedia-core

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.6.0](https://img.shields.io/badge/AppVersion-v0.6.0-informational?style=flat-square)

A Helm chart for Clusterpedia

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| clusterpedia-io | | <https://github.com/clusterpedia-io/clusterpedia-helm> |

## Source Code

* <https://github.com/clusterpedia-io/clusterpedia-helm>

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | common | 1.x.x |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| apiserver.affinity | object | `{}` | |
| apiserver.enableSHA1Cert | bool | `false` | |
| apiserver.featureGates.AllowRawSQLQuery | bool | `false` | |
| apiserver.featureGates.RemainingItemCount | bool | `false` | |
| apiserver.image.pullPolicy | string | `"IfNotPresent"` | |
| apiserver.image.pullSecrets | list | `[]` | |
| apiserver.image.registry | string | `"ghcr.io"` | |
| apiserver.image.repository | string | `"clusterpedia-io/clusterpedia/apiserver"` | |
| apiserver.image.tag | string | `"v0.6.0"` | |
| apiserver.labels | object | `{}` | |
| apiserver.nodeSelector | object | `{}` | |
| apiserver.podAnnotations | object | `{}` | |
| apiserver.podLabels | object | `{}` | |
| apiserver.replicaCount | int | `1` | |
| apiserver.resources | object | `{}` | |
| apiserver.tolerations | list | `[]` | |
| clustersynchroManager.affinity | object | `{}` | |
| clustersynchroManager.featureGates.AllowSyncAllCustomResources | bool | `false` | |
| clustersynchroManager.featureGates.AllowSyncAllResources | bool | `false` | |
| clustersynchroManager.featureGates.PruneLastAppliedConfiguration | bool | `true` | |
| clustersynchroManager.featureGates.PruneManagedFields | bool | `true` | |
| clustersynchroManager.image.pullPolicy | string | `"IfNotPresent"` | |
| clustersynchroManager.image.pullSecrets | list | `[]` | |
| clustersynchroManager.image.registry | string | `"ghcr.io"` | |
| clustersynchroManager.image.repository | string | `"clusterpedia-io/clusterpedia/clustersynchro-manager"` | |
| clustersynchroManager.image.tag | string | `"v0.6.0"` | |
| clustersynchroManager.labels | object | `{}` | |
| clustersynchroManager.nodeSelector | object | `{}` | |
| clustersynchroManager.podAnnotations | object | `{}` | |
| clustersynchroManager.podLabels | object | `{}` | |
| clustersynchroManager.replicaCount | int | `1` | |
| clustersynchroManager.resources | object | `{}` | |
| clustersynchroManager.tolerations | list | `[]` | |
| commonAnnotations | object | `{}` | |
| commonLabels | object | `{}` | |
| controllerManager.affinity | object | `{}` | |
| controllerManager.featureGates | object | `{}` | |
| controllerManager.image.pullPolicy | string | `"IfNotPresent"` | |
| controllerManager.image.pullSecrets | list | `[]` | |
| controllerManager.image.registry | string | `"ghcr.io"` | |
| controllerManager.image.repository | string | `"clusterpedia-io/clusterpedia/controller-manager"` | |
| controllerManager.image.tag | string | `"v0.6.0"` | |
| controllerManager.labels | object | `{}` | |
| controllerManager.nodeSelector | object | `{}` | |
| controllerManager.podAnnotations | object | `{}` | |
| controllerManager.podLabels | object | `{}` | |
| controllerManager.replicaCount | int | `1` | |
| controllerManager.resources | object | `{}` | |
| controllerManager.tolerations | list | `[]` | |
| global.imagePullSecrets | list | `[]` | |
| global.imageRegistry | string | `""` | |
| hookJob.image.pullPolicy | string | `"IfNotPresent"` | |
| hookJob.image.registry | string | `"ghcr.io"` | |
| hookJob.image.repository | string | `"cloudtty/cloudshell"` | |
| hookJob.image.tag | string | `"v0.4.0"` | |
| installCRDs | bool | `false` | |
| storage.componentEnv | list | `[]` | |
| storage.config | object | `{}` | |
| storage.configMap | string | `""` | |
| storage.image.pullPolicy | string | `"IfNotPresent"` | |
| storage.image.registry | string | `""` | |
| storage.image.repository | string | `""` | |
| storage.image.tag | string | `""` | |
| storage.name | string | `""` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.9.1](https://github.com/norwoodj/helm-docs/releases/v1.9.1)
66 changes: 66 additions & 0 deletions charts/clusterpedia-mysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# clusterpedia-mysql

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.6.0](https://img.shields.io/badge/AppVersion-v0.6.0-informational?style=flat-square)

A Helm chart for Clusterpedia

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| clusterpedia-io | | <https://github.com/clusterpedia-io/clusterpedia-helm> |

## Source Code

* <https://github.com/clusterpedia-io/clusterpedia-helm>

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | common | 1.x.x |
| https://charts.bitnami.com/bitnami | mysql | 9.x.x |
| https://clusterpedia-io.github.io/clusterpedia-helm/ | clusterpedia-core | 0.1.x |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| commonAnnotations | object | `{}` | |
| commonLabels | object | `{}` | |
| externalStorage.createDatabase | bool | `false` | |
| externalStorage.database | string | `""` | |
| externalStorage.host | string | `""` | |
| externalStorage.password | string | `""` | |
| externalStorage.port | string | `nil` | |
| externalStorage.user | string | `""` | |
| global.imagePullSecrets | list | `[]` | |
| global.imageRegistry | string | `""` | |
| installCRDs | bool | `false` | |
| mysql.auth.database | string | `"clusterpedia"` | |
| mysql.auth.password | string | `""` | |
| mysql.auth.rootPassword | string | `"dangerous0"` | |
| mysql.auth.username | string | `""` | |
| mysql.image.pullPolicy | string | `"IfNotPresent"` | |
| mysql.image.pullSecrets | list | `[]` | |
| mysql.image.registry | string | `"docker.io"` | |
| mysql.image.repository | string | `"bitnami/mysql"` | |
| mysql.image.tag | string | `"8.0.28-debian-10-r23"` | |
| mysql.primary.persistence.enabled | bool | `true` | |
| mysql.primary.persistence.size | string | `"10Gi"` | |
| persistenceMatchNode | string | `""` | |
| storageConfig.connPool.connMaxLifetime | string | `"60m"` | |
| storageConfig.connPool.maxIdleConns | int | `5` | |
| storageConfig.connPool.maxOpenConns | int | `40` | |
| storageConfig.log.enabled | bool | `false` | |
| storageConfig.log.ignoreRecordNotFoundError | bool | `false` | |
| storageConfig.log.level | string | `"Warn"` | |
| storageConfig.log.logger.filename | string | `"/var/log/clusterpedia/internalstorage.log"` | |
| storageConfig.log.logger.maxbackups | int | `0` | |
| storageConfig.log.logger.maxsize | int | `100` | |
| storageConfig.log.slowThreshold | string | `"100ms"` | |
| storageConfig.log.stdout | bool | `false` | |
| storageInstallMode | string | `"internal"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.9.1](https://github.com/norwoodj/helm-docs/releases/v1.9.1)
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.1.0
version: 2.2.0

# 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
10 changes: 6 additions & 4 deletions charts/clusterpedia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,14 @@ rm /var/local/clusterpedia/internalstorage/<storage type>
| apiserver.image.pullSecrets | list | `[]` | |
| apiserver.image.registry | string | `"ghcr.io"` | |
| apiserver.image.repository | string | `"clusterpedia-io/clusterpedia/apiserver"` | |
| apiserver.image.tag | string | `"v0.7.0"` | |
| apiserver.image.tag | string | `"v0.7.1"` | |
| apiserver.labels | object | `{}` | |
| apiserver.nodeSelector | object | `{}` | |
| apiserver.podAnnotations | object | `{}` | |
| apiserver.podLabels | object | `{}` | |
| apiserver.replicaCount | int | `1` | |
| apiserver.resources | object | `{}` | |
| apiserver.telemetry.tracing | string | `nil` | |
| apiserver.tolerations | list | `[]` | |

### ClustersynchroManager
Expand All @@ -247,7 +248,8 @@ rm /var/local/clusterpedia/internalstorage/<storage type>
| clustersynchroManager.image.pullSecrets | list | `[]` | |
| clustersynchroManager.image.registry | string | `"ghcr.io"` | |
| clustersynchroManager.image.repository | string | `"clusterpedia-io/clusterpedia/clustersynchro-manager"` | |
| clustersynchroManager.image.tag | string | `"v0.7.0"` | |
| clustersynchroManager.image.tag | string | `"v0.7.1"` | |
| clustersynchroManager.kubeStateMetrics.enabled | bool | `false` | |
| clustersynchroManager.labels | object | `{}` | |
| clustersynchroManager.leaderElect.leaseDuration | string | `"15s"` | |
| clustersynchroManager.leaderElect.renewDeadline | string | `"10s"` | |
Expand All @@ -271,7 +273,7 @@ rm /var/local/clusterpedia/internalstorage/<storage type>
| controllerManager.image.pullSecrets | list | `[]` | |
| controllerManager.image.registry | string | `"ghcr.io"` | |
| controllerManager.image.repository | string | `"clusterpedia-io/clusterpedia/controller-manager"` | |
| controllerManager.image.tag | string | `"v0.7.0"` | |
| controllerManager.image.tag | string | `"v0.7.1"` | |
| controllerManager.labels | object | `{}` | |
| controllerManager.nodeSelector | object | `{}` | |
| controllerManager.podAnnotations | object | `{}` | |
Expand All @@ -281,4 +283,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)
28 changes: 28 additions & 0 deletions charts/clusterpedia/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,31 @@ 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.apiserver.tracing.env" -}}
{{- if .Values.apiserver.telemetry.tracing.addOtelEnv }}
{{- if not (empty .Values.apiserver.telemetry.tracing.endpoint) }}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{ .Values.apiserver.telemetry.tracing.endpoint }}
{{- end -}}
- 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 -}}
14 changes: 14 additions & 0 deletions charts/clusterpedia/templates/apiserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ spec:
- /usr/local/bin/apiserver
- --secure-port=443
- --storage-config=/etc/clusterpedia/storage/internalstorage-config.yaml
{{- if or (not empty .Values.apiserver.telemetry.tracing.endpoint) (not empty .Values.apiserver.telemetry.tracing.samplingRatePerMillion) }}
- --tracing-config-file=/etc/clusterpedia/trace/tracing-config.yaml
{{- end }}
{{- with (include "clusterpedia.apiserver.featureGates" .) }}
- {{ . }}
{{- end }}
Expand All @@ -132,6 +135,7 @@ spec:
secretKeyRef:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
key: password
{{- include "clusterpedia.apiserver.tracing.env" . | nindent 8 }}
{{- if .Values.apiserver.enableSHA1Cert }}
- name: GODEBUG
value: netdns=go,x509sha1=1
Expand All @@ -143,6 +147,11 @@ spec:
- name: internalstorage-config
mountPath: /etc/clusterpedia/storage
readOnly: true
{{- if or (not empty .Values.apiserver.telemetry.tracing.endpoint) (not empty .Values.apiserver.telemetry.tracing.samplingRatePerMillion) }}
- name: tracing-config
mountPath: /etc/clusterpedia/trace
readOnly: true
{{- end }}
serviceAccountName: {{ include "clusterpedia.apiserver.fullname" . }}
{{- if .Values.apiserver.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.affinity "context" $) | nindent 8 }}
Expand All @@ -160,3 +169,8 @@ spec:
- name: scripts
configMap:
name: {{ include "clusterpedia.scripts.fullname" . }}
{{- if or (not empty .Values.apiserver.telemetry.tracing.endpoint) (not empty .Values.apiserver.telemetry.tracing.samplingRatePerMillion) }}
- name: tracing-config
configMap:
name: {{ include "clusterpedia.apiserver.fullname" .}}-tracing-config
{{- end }}
13 changes: 13 additions & 0 deletions charts/clusterpedia/templates/clusterpedia-tracing-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if or (not (empty.Values.apiserver.telemetry.tracing.endpoint)) (not (empty .Values.apiserver.telemetry.tracing.samplingRatePerMillion)) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "clusterpedia.apiserver.fullname" .}}-tracing-config
namespace: {{ .Release.Namespace }}
data:
tracing-config.yaml: |
apiVersion: apiserver.config.k8s.io/v1beta1
kind: TracingConfiguration
endpoint: {{ .Values.apiserver.telemetry.tracing.endpoint }}
samplingRatePerMillion: {{ .Values.apiserver.telemetry.tracing.samplingRatePerMillion }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/clusterpedia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,20 @@ apiserver:
## alpha: v0.3.0
## AllowRawSQLQuery: false

## @param APIServerTracing add support for distributed tracing in the API Server
## APIServerTracing: true

## @param apiserver.enableSHA1Cert specifies whether to allow SHA1 certificates for apiserver.
enableSHA1Cert: false

## @param telemetry define flag whether to enable otel trace
##
telemetry:
tracing:
# endpoint: "localhost:4317"
# samplingRatePerMillion: 1000000
# addOtelEnv: false

## clustersynchro manager config
clustersynchroManager:
## @param clustersynchroManager.workerNumber set the number of workers
Expand Down

0 comments on commit d7d2be0

Please sign in to comment.