Skip to content

Commit

Permalink
feat: add otelcollector support for meteor (#54)
Browse files Browse the repository at this point in the history
Co-authored-by: Hermawan Wijaya <[email protected]>
  • Loading branch information
batrov and batrov authored Oct 9, 2023
1 parent a53988c commit 05fa0f6
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 8 deletions.
4 changes: 2 additions & 2 deletions stable/meteor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.3.0
version: 0.3.1
description: A Helm chart for Meteor (github.com/goto/meteor)
name: meteor
appVersion: "v0.8.0"
appVersion: "v0.8.9"
70 changes: 64 additions & 6 deletions stable/meteor/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ spec:
image: "{{ required `image.repository is required` .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
{{- if .Values.telegraf.enabled }}
- /bin/sh
- -c
- |
meteor run /opt/recipes;
{{- if .Values.telegraf.enabled }}
pkill -SIGTERM telegraf
{{- else}}
- meteor
- run
- /opt/recipes
{{- end }}
{{- if .Values.otelcollector.enabled }}
pkill -SIGTERM otelcol-contrib
{{- end }}
volumeMounts:
- name: "{{ include "meteor.name" . }}-volume"
Expand All @@ -51,6 +50,58 @@ spec:
- secretRef:
name: "{{ include "meteor.name" . }}-secret"
{{- end }}
{{- if .Values.otelcollector.enabled }}
- name: otel-collector-sidecar
image: {{ .Values.otelcollector.image }}
imagePullPolicy: IfNotPresent
args:
- "--config=/etc/otelcollector/config.yaml"
ports:
- containerPort: 1888
name: pprof
protocol: TCP
- containerPort: 8888
name: prometheusself
protocol: TCP
- containerPort: 8889
name: prometheus
protocol: TCP
- containerPort: 13133
name: healthcheck
protocol: TCP
- containerPort: 4317
name: otlpgrpcrecv
protocol: TCP
- containerPort: 4318
name: otlphttprecv
protocol: TCP
- containerPort: 55679
name: zpages
protocol: TCP
env:
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: K8S_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: OTEL_RESOURCE_ATTRIBUTES
value: |
k8s.deployment.name={{ include "meteor.name" . }},k8s.namespace.name=$(K8S_POD_NAMESPACE),k8s.node.name=$(K8S_NODE_NAME),k8s.pod.name=$(K8S_POD_NAME),k8s.pod.ip=$(K8S_POD_IP)
volumeMounts:
- name: otelcollector-conf
mountPath: /etc/otelcollector/
{{- end }}
{{- if .Values.telegraf.enabled }}
- name: telegraf-sidecar
image: {{ .Values.telegraf.image }}
Expand All @@ -70,8 +121,10 @@ spec:
volumeMounts:
- name: telegraf-conf
mountPath: /etc/telegraf/
shareProcessNamespace: true
{{- end }}
{{- if or .Values.telegraf.enabled .Values.otelcollector.enabled }}
shareProcessNamespace: true
{{- end}}
restartPolicy: Never
volumes:
- name: "{{ include "meteor.name" . }}-volume"
Expand All @@ -94,3 +147,8 @@ spec:
configMap:
name: {{ include "meteor.name" . }}-telegraf
{{- end }}
{{- if .Values.otelcollector.enabled }}
- name: otelcollector-conf
configMap:
name: {{ include "meteor.name" . }}-otelcollector
{{- end }}
13 changes: 13 additions & 0 deletions stable/meteor/templates/otelcollector-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.otelcollector.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "meteor.name" . }}-otelcollector
labels:
{{- if .Values.labels }}
{{ toYaml .Values.labels | indent 4 }}
{{- end }}
data:
config.yaml: |-
{{ .Values.otelcollector.config | indent 4 }}
{{- end }}
19 changes: 19 additions & 0 deletions stable/meteor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,22 @@ telegraf:
args:
command:
- telegraf

otelcollector:
enabled: false
image: otel/opentelemetry-collector-contrib:0.79.0
config: |
receivers:
otlp:
protocols:
grpc:
http:
processors:
exporters:
logging:
service:
pipelines:
traces:
receivers: [otlp]
processors: []
exporters: [logging]

0 comments on commit 05fa0f6

Please sign in to comment.