From cd9cd01f3ccc9a4fc6582cc31bcf589dc27c5cfc Mon Sep 17 00:00:00 2001 From: Nicolas Takashi Date: Wed, 23 Aug 2023 20:51:52 +0100 Subject: [PATCH] Update charts/opentelemetry-ebpf/Chart.yaml Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> --- charts/opentelemetry-ebpf/Chart.yaml | 5 +-- .../examples/cloud-collector/values.yaml | 2 +- .../opentelemetry-ebpf/templates/_helpers.tpl | 21 +++++++++- .../templates/cloud-collector-deployment.yaml | 6 +-- .../templates/k8s-collector-deployment.yaml | 14 +++---- .../templates/kernel-collector-daemonset.yaml | 11 +++--- .../templates/reducer-deployment.yaml | 20 +++++----- .../templates/reducer-service.yaml | 16 +++----- charts/opentelemetry-ebpf/values.schema.json | 6 +-- charts/opentelemetry-ebpf/values.yaml | 39 +++++++++++++------ 10 files changed, 83 insertions(+), 57 deletions(-) diff --git a/charts/opentelemetry-ebpf/Chart.yaml b/charts/opentelemetry-ebpf/Chart.yaml index 24e3c3776..fefe51c52 100644 --- a/charts/opentelemetry-ebpf/Chart.yaml +++ b/charts/opentelemetry-ebpf/Chart.yaml @@ -5,10 +5,9 @@ description: OpenTelemetry eBPF Helm chart for Kubernetes type: application home: https://opentelemetry.io/ sources: - - https://github.com/open-telemetry/opentelemetry-collector - - https://github.com/open-telemetry/opentelemetry-collector-contrib - https://github.com/open-telemetry/opentelemetry-ebpf maintainers: - name: dmitryax + - name: TylerHelmuth icon: https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png -appVersion: 0.10.0 +appVersion: v0.10.0 diff --git a/charts/opentelemetry-ebpf/examples/cloud-collector/values.yaml b/charts/opentelemetry-ebpf/examples/cloud-collector/values.yaml index f02009cbb..a16615a17 100644 --- a/charts/opentelemetry-ebpf/examples/cloud-collector/values.yaml +++ b/charts/opentelemetry-ebpf/examples/cloud-collector/values.yaml @@ -1,5 +1,5 @@ cloudCollector: enabled: true -otelCollector: +endpoint: address: example-opentelemetry-collector diff --git a/charts/opentelemetry-ebpf/templates/_helpers.tpl b/charts/opentelemetry-ebpf/templates/_helpers.tpl index 63aa19686..1c393c04f 100644 --- a/charts/opentelemetry-ebpf/templates/_helpers.tpl +++ b/charts/opentelemetry-ebpf/templates/_helpers.tpl @@ -135,4 +135,23 @@ Fully qualified app name for the reducer deployment. {{- else -}} {{- printf "%s-%s-reducer" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* Build the list of port for service */}} +{{- define "opentelemetry-collector-reducer.servicePortsConfig" -}} +{{- $ports := deepCopy .Values.reducer.service.ports }} +{{- range $key, $port := $ports }} +{{- if $port.enabled }} +- name: {{ $key }} + port: {{ $port.servicePort }} + targetPort: {{ $port.containerPort }} + protocol: {{ $port.protocol }} + {{- if $port.appProtocol }} + appProtocol: {{ $port.appProtocol }} + {{- end }} +{{- if $port.nodePort }} + nodePort: {{ $port.nodePort }} +{{- end }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/opentelemetry-ebpf/templates/cloud-collector-deployment.yaml b/charts/opentelemetry-ebpf/templates/cloud-collector-deployment.yaml index 2dfff97df..51be24032 100644 --- a/charts/opentelemetry-ebpf/templates/cloud-collector-deployment.yaml +++ b/charts/opentelemetry-ebpf/templates/cloud-collector-deployment.yaml @@ -28,8 +28,8 @@ spec: {{- end }} {{- end }} containers: - - image: "{{ default .Values.images.repository .Values.cloudCollector.image.repository }}/{{ .Values.cloudCollector.image.name }}:{{ default .Values.images.tag .Values.cloudCollector.image.tag }}" - imagePullPolicy: {{ .Values.images.pullPolicy }} + - image: "{{ default .Values.image.registry .Values.cloudCollector.image.registry }}/{{ .Values.cloudCollector.image.name }}:{{ default .Values.image.tag .Values.cloudCollector.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} name: cloud-collector {{- if hasKey .Values.cloudCollector "resources" }} resources: @@ -74,7 +74,7 @@ spec: - name: "EBPF_NET_INTAKE_HOST" value: {{ include "opentelemetry-collector-reducer.fullname" . }} - name: "EBPF_NET_INTAKE_PORT" - value: "{{ default 7000 .Values.reducer.telemetryPort }}" + value: "{{ default 7000 .Values.reducer.service.ports.telemetry.port }}" {{- if hasKey .Values "debug" }} {{- if (default false .Values.debug.storeMinidump) }} - name: "EBPF_NET_MINIDUMP_DIR" diff --git a/charts/opentelemetry-ebpf/templates/k8s-collector-deployment.yaml b/charts/opentelemetry-ebpf/templates/k8s-collector-deployment.yaml index 253c1a0a5..420ddf504 100644 --- a/charts/opentelemetry-ebpf/templates/k8s-collector-deployment.yaml +++ b/charts/opentelemetry-ebpf/templates/k8s-collector-deployment.yaml @@ -37,8 +37,8 @@ spec: {{- end }} {{- end }} containers: - - image: "{{ default .Values.images.repository .Values.k8sCollector.watcher.image.repository }}/{{ .Values.k8sCollector.watcher.image.name }}:{{ default .Values.images.tag .Values.k8sCollector.watcher.image.tag }}" - imagePullPolicy: {{ .Values.images.pullPolicy }} + - image: "{{ default .Values.image.registry .Values.k8sCollector.watcher.image.repository }}/{{ .Values.k8sCollector.watcher.image.name }}:{{ default .Values.image.tag .Values.k8sCollector.watcher.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} name: k8s-watcher {{- if hasKey .Values.k8sCollector.watcher "resources" }} resources: @@ -52,8 +52,8 @@ spec: # k8s-relay, which is a service that the k8s-watcher talks to. # Currently not configurable, has to be reachable on localhost:8172, so must # share a pod with the k8s-watcher above. - - image: "{{ default .Values.images.repository .Values.k8sCollector.relay.image.repository }}/{{ .Values.k8sCollector.relay.image.name }}:{{ default .Values.images.tag .Values.k8sCollector.relay.image.tag }}" - imagePullPolicy: {{ .Values.images.pullPolicy }} + - image: "{{ default .Values.image.registry .Values.k8sCollector.relay.image.registry }}/{{ .Values.k8sCollector.relay.image.name }}:{{ default .Values.image.tag .Values.k8sCollector.relay.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} name: k8s-relay {{- if hasKey .Values.k8sCollector.relay "resources" }} resources: @@ -99,7 +99,7 @@ spec: - name: "EBPF_NET_INTAKE_HOST" value: {{ include "opentelemetry-collector-reducer.fullname" . }} - name: "EBPF_NET_INTAKE_PORT" - value: "{{ default 7000 .Values.reducer.telemetryPort }}" + value: "{{ default 7000 .Values.reducer.service.ports.telemetry.port }}" {{- if hasKey .Values "debug" }} {{- if (default false .Values.debug.storeMinidump) }} - name: "EBPF_NET_MINIDUMP_DIR" @@ -108,9 +108,9 @@ spec: {{- end }} {{- if and .Values.debug.enabled .Values.debug.sendUnplannedExitMetric }} - name: "EBPF_NET_CRASH_METRIC_HOST" - value: {{ .Values.otelCollector.address }} + value: {{ .Values.endpoint.address }} - name: "EBPF_NET_CRASH_METRIC_PORT" - value: {{ .Values.otelCollector.port | default 4317 }} + value: {{ .Values.endpoint.port | default 4317 }} {{- end }} {{- if .Values.k8sCollector.relay.env }} {{ toYaml .Values.k8sCollector.relay.env | indent 10 }} diff --git a/charts/opentelemetry-ebpf/templates/kernel-collector-daemonset.yaml b/charts/opentelemetry-ebpf/templates/kernel-collector-daemonset.yaml index 32ea0e2ab..51ef8074e 100644 --- a/charts/opentelemetry-ebpf/templates/kernel-collector-daemonset.yaml +++ b/charts/opentelemetry-ebpf/templates/kernel-collector-daemonset.yaml @@ -17,7 +17,6 @@ spec: template: metadata: annotations: - release_number: "3" charts.flowmill.com/version: {{ .Chart.Version }} labels: app.kubernetes.io/name: {{ include "opentelemetry-collector-kernel-collector.fullname" . }} @@ -31,8 +30,8 @@ spec: {{- end }} containers: - name: kernel-collector - image: "{{ default .Values.images.repository .Values.kernelCollector.image.repository }}/{{ .Values.kernelCollector.image.name }}:{{ default .Values.images.tag .Values.kernelCollector.image.tag }}" - imagePullPolicy: {{ .Values.images.pullPolicy }} + image: "{{ default .Values.image.registry .Values.kernelCollector.image.registry }}/{{ .Values.kernelCollector.image.name }}:{{ default .Values.image.tag .Values.kernelCollector.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} args: - --config-file=/etc/network-explorer/config.yaml {{- if .Values.kernelCollector.bpfDumpFile }} @@ -93,7 +92,7 @@ spec: - name: "EBPF_NET_INTAKE_HOST" value: {{ include "opentelemetry-collector-reducer.fullname" . }} - name: "EBPF_NET_INTAKE_PORT" - value: "{{ default 7000 .Values.reducer.telemetryPort }}" + value: "{{ default 7000 .Values.reducer.service.ports.telemetry.port }}" {{- if .Values.kernelCollector.exportBpfSrcFile }} - name: "EBPF_NET_EXPORT_BPF_SRC_FILE" value: {{ quote .Values.kernelCollector.exportBpfSrcFile }} @@ -108,9 +107,9 @@ spec: {{- end }} {{- if and .Values.debug.enabled .Values.debug.sendUnplannedExitMetric }} - name: "EBPF_NET_CRASH_METRIC_HOST" - value: {{ .Values.otelCollector.address }} + value: {{ .Values.endpoint.address }} - name: "EBPF_NET_CRASH_METRIC_PORT" - value: {{ .Values.otelCollector.port | default 4317 }} + value: {{ .Values.endpoint.port | default 4317 }} {{- end }} {{- if .Values.kernelCollector.env }} {{ toYaml .Values.kernelCollector.env | indent 12 }} diff --git a/charts/opentelemetry-ebpf/templates/reducer-deployment.yaml b/charts/opentelemetry-ebpf/templates/reducer-deployment.yaml index 6bc589cf4..40e337f7d 100644 --- a/charts/opentelemetry-ebpf/templates/reducer-deployment.yaml +++ b/charts/opentelemetry-ebpf/templates/reducer-deployment.yaml @@ -26,10 +26,10 @@ spec: {{- end }} containers: - name: reducer - image: "{{ default .Values.images.repository .Values.reducer.image.repository }}/{{ .Values.reducer.image.name }}:{{ default .Values.images.tag .Values.reducer.image.tag }}" - imagePullPolicy: {{ .Values.images.pullPolicy }} + image: "{{ default .Values.image.registry .Values.reducer.image.registry }}/{{ .Values.reducer.image.name }}:{{ default .Values.image.tag .Values.reducer.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} args: - - --port={{- .Values.reducer.telemetryPort }} + - --port={{- .Values.reducer.service.ports.telemetry.containerPort }} - --log-console - --no-log-file {{- if hasKey .Values.log "level" }} @@ -38,8 +38,8 @@ spec: - --enable-aws-enrichment - --disable-prometheus-metrics - --enable-otlp-grpc-metrics - - --otlp-grpc-metrics-host={{ .Values.otelCollector.address }} - - --otlp-grpc-metrics-port={{ .Values.otelCollector.port | default 4317 }} + - --otlp-grpc-metrics-host={{ .Values.endpoint.address }} + - --otlp-grpc-metrics-port={{ .Values.endpoint.port | default 4317 }} {{- if .Values.reducer.disableMetrics }} - --disable-metrics={{join "," .Values.reducer.disableMetrics}} {{- end }} @@ -66,18 +66,18 @@ spec: {{- end }} {{- if .Values.debug.sendUnplannedExitMetric }} - name: "EBPF_NET_CRASH_METRIC_HOST" - value: {{ .Values.otelCollector.address }} + value: {{ .Values.endpoint.address }} - name: "EBPF_NET_CRASH_METRIC_PORT" - value: {{ .Values.otelCollector.port | default 4317 }} + value: {{ .Values.endpoint.port | default 4317 }} {{- end }} {{- end }} ports: - name: telemetry - containerPort: {{ .Values.reducer.telemetryPort }} + containerPort: {{ .Values.reducer.service.ports.telemetry.containerPort }} protocol: TCP {{- if not .Values.reducer.disableInternalMetrics }} - name: stats - containerPort: {{ .Values.reducer.statsPromPort }} + containerPort: {{ .Values.reducer.service.ports.stats.containerPort }} protocol: TCP {{- end }} {{- if .Values.debug.enabled }} @@ -93,7 +93,7 @@ spec: periodSeconds: 20 timeoutSeconds: 5 exec: - command: ['/srv/health_check.sh', 'readiness_probe', 'localhost', {{ quote .Values.reducer.telemetryPort }}] + command: ['/srv/health_check.sh', 'readiness_probe', 'localhost', {{ quote .Values.reducer.service.ports.telemetry.containerPort }}] {{- if .Values.resources }} resources: {{- toYaml .Values.resources | nindent 12 }} diff --git a/charts/opentelemetry-ebpf/templates/reducer-service.yaml b/charts/opentelemetry-ebpf/templates/reducer-service.yaml index 0f7028e10..3166dd330 100644 --- a/charts/opentelemetry-ebpf/templates/reducer-service.yaml +++ b/charts/opentelemetry-ebpf/templates/reducer-service.yaml @@ -5,18 +5,12 @@ metadata: labels: {{- include "opentelemetry-ebpf.labels" . | nindent 4 }} spec: - type: ClusterIP + type: {{ .Values.reducer.service.type }} selector: app.kubernetes.io/name: {{ include "opentelemetry-collector-reducer.fullname" . }} app.kubernetes.io/instance: {{ .Release.Name }} + {{- $ports := include "opentelemetry-collector-reducer.servicePortsConfig" . }} + {{- if $ports }} ports: - - name: telemetry - port: {{ .Values.reducer.telemetryPort }} - targetPort: telemetry - protocol: TCP - {{- if not .Values.reducer.disableInternalMetrics }} - - name: stats - port: {{ .Values.reducer.statsPromPort }} - targetPort: stats - protocol: TCP - {{- end }} + {{- $ports | nindent 4}} + {{- end }} diff --git a/charts/opentelemetry-ebpf/values.schema.json b/charts/opentelemetry-ebpf/values.schema.json index 0eae4b477..f7e78cdda 100644 --- a/charts/opentelemetry-ebpf/values.schema.json +++ b/charts/opentelemetry-ebpf/values.schema.json @@ -19,7 +19,7 @@ "description": "Cluster Name", "type": "string" }, - "otelCollector": { + "endpoint": { "type": "object", "additionalProperties": false, "required": [ @@ -70,7 +70,7 @@ } } }, - "images": { + "image": { "description": "images", "type": "object", "additionalProperties": false, @@ -78,7 +78,7 @@ "tag": { "type": "string" }, - "repository": { + "registry": { "type": "string" }, "pullPolicy": { diff --git a/charts/opentelemetry-ebpf/values.yaml b/charts/opentelemetry-ebpf/values.yaml index 6d02e918d..1819891fd 100644 --- a/charts/opentelemetry-ebpf/values.yaml +++ b/charts/opentelemetry-ebpf/values.yaml @@ -4,19 +4,18 @@ nameOverride: "" fullnameOverride: "" - clusterName: "" -images: - tag: "v0.10.0" - repository: otel +image: + tag: "" + registry: otel pullPolicy: IfNotPresent imagePullSecrets: [] resources: {} -otelCollector: +endpoint: address: "" port: "" @@ -36,7 +35,7 @@ kernelCollector: create: true name: "" image: - repository: "" + registry: "" tag: "" name: opentelemetry-ebpf-kernel-collector @@ -64,7 +63,7 @@ kernelCollector: cloudCollector: enabled: false image: - repository: "" + registry: "" tag: "" name: opentelemetry-ebpf-cloud-collector @@ -85,12 +84,12 @@ k8sCollector: name: "" relay: image: - repository: "" + registry: "" tag: "" name: opentelemetry-ebpf-k8s-relay watcher: image: - repository: "" + registry: "" tag: "" name: opentelemetry-ebpf-k8s-watcher @@ -99,7 +98,7 @@ k8sCollector: reducer: image: - repository: "" + registry: "" tag: "" name: opentelemetry-ebpf-reducer extraArgs: {} @@ -251,12 +250,28 @@ reducer: # - ebpf_net.codetiming_sum_ns # - ebpf_net.otlp_grpc.failed_requests # - ebpf_net.rpc_queue_buf_utilization - telemetryPort: 7000 - statsPromPort: 7001 + resources: {} nodeSelector: {} tolerations: [] affinity: {} + service: + type: ClusterIP + ports: + telemetry: + enabled: true + port: 7000 + containerPort: 7000 + targetPort: 7000 + protocol: TCP + appProtocol: http + stats: + enabled: true + port: 7001 + containerPort: 7001 + targetPort: 7001 + protocol: TCP + appProtocol: http rbac: create: true