Skip to content

Commit

Permalink
feat(observability-pipeline): add opampsupervisor support (#415)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?

Allows the chart to install an opamp-managed collector (implemented via
the opampsupervisor) that communicates with the control plane

## Short description of the changes

- update test to not install an opamp-managed collector
- update control-plane helper templates to be namespaced with
`controlPlane`
- add template files for installing an opampsupervisor deployment.
- update NOTES.txt to enforce specifying an image for the
opampsupervisor

## How to verify that this has the expected result

Tested locally in kind.

---------

Co-authored-by: Alex Boten <[email protected]>
  • Loading branch information
TylerHelmuth and codeboten authored Jan 24, 2025
1 parent 35365fb commit 9ed8204
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 16 deletions.
2 changes: 1 addition & 1 deletion charts/observability-pipeline/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: observability-pipeline
description: Chart to deploy both OpenTelemetry Collector and Honeycomb Refinery
type: application
version: 0.0.8-alpha
version: 0.0.9-alpha
appVersion: 0.0.1-alpha
keywords:
- refinery
Expand Down
3 changes: 3 additions & 0 deletions charts/observability-pipeline/ci/collectors-values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
refinery:
enabled: false

collector:
enabled: false

otelcol-deployment:
enabled: true
extraEnvs: []
Expand Down
12 changes: 12 additions & 0 deletions charts/observability-pipeline/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ Honeycomb Observability Pipeline is setup and configured.
{{- end }}

{{- end }}

{{- if .Values.collector.enabled }}

{{- if (not .Values.collector.image.repository) }}
{{- fail "collector.image.repository must be set" }}
{{- end }}

{{- if (not .Values.collector.image.tag) }}
{{- fail "collector.image.tag must be set" }}
{{- end }}

{{- end }}
68 changes: 62 additions & 6 deletions charts/observability-pipeline/templates/_helpters.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ Create chart name and version as used by the chart label.
{{- end }}

{{/*
Common labels
Common control plane labels
*/}}
{{- define "honeycomb-observability-pipeline.labels" -}}
{{- define "honeycomb-observability-pipeline.controlPlane.labels" -}}
helm.sh/chart: {{ include "honeycomb-observability-pipeline.chart" . }}
{{ include "honeycomb-observability-pipeline.selectorLabels" . }}
{{ include "honeycomb-observability-pipeline.controlPlane.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
Control Plane Selector labels
*/}}
{{- define "honeycomb-observability-pipeline.selectorLabels" -}}
{{- define "honeycomb-observability-pipeline.controlPlane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "honeycomb-observability-pipeline.name" . }}-control-plane
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use for the control plane
*/}}
{{- define "honeycomb-observability-pipeline.serviceAccountName" -}}
{{- define "honeycomb-observability-pipeline.controlPlane.serviceAccountName" -}}
{{- if .Values.controlPlane.serviceAccount.create }}
{{- default (printf "%s-control-plane" (include "honeycomb-observability-pipeline.fullname" .)) .Values.controlPlane.serviceAccount.name }}
{{- else }}
Expand All @@ -77,3 +77,59 @@ Build otel config file for Control Plane
{{- tpl (toYaml .Values.controlPlane.telemetry.config) . }}
{{- end }}

{{/*
Build config file for collector
*/}}
{{- define "honeycomb-observability-pipeline.collectorConfig" -}}
server:
endpoint: ws://{{ include "honeycomb-observability-pipeline.name" . }}-observability-pipeline-control-plane:4320/v1/opamp
tls:
# Disable verification to test locally.
# Don't do this in production.
insecure_skip_verify: true
# For more TLS settings see config/configtls.ClientConfig

capabilities:
reports_effective_config: true
reports_own_metrics: false
reports_health: true
accepts_remote_config: true
reports_remote_config: true

agent:
executable: /otelcol-contrib

storage:
directory: /var/lib/otelcol/supervisor
{{- end }}

{{/*
Create the name of the service account to use for the collector
*/}}
{{- define "honeycomb-observability-pipeline.collector.serviceAccountName" -}}
{{- if .Values.collector.serviceAccount.create }}
{{- default (printf "%s-collector" (include "honeycomb-observability-pipeline.fullname" .)) .Values.collector.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.collector.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Common collector labels
*/}}
{{- define "honeycomb-observability-pipeline.collector.labels" -}}
helm.sh/chart: {{ include "honeycomb-observability-pipeline.chart" . }}
{{ include "honeycomb-observability-pipeline.collector.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Collector Selector labels
*/}}
{{- define "honeycomb-observability-pipeline.collector.selectorLabels" -}}
app.kubernetes.io/name: {{ include "honeycomb-observability-pipeline.name" . }}-collector
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/observability-pipeline/templates/collector-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if and .Values.collector.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-collector
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.collector.labels" . | nindent 4 }}
app.kubernetes.io/component: collector
data:
config: |
{{- include "honeycomb-observability-pipeline.collectorConfig" . | nindent 4 -}}
{{- end }}
45 changes: 45 additions & 0 deletions charts/observability-pipeline/templates/collector-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- if .Values.collector.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-collector
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.collector.labels" . | nindent 4 }}
app.kubernetes.io/component: collector
spec:
replicas: {{ .Values.collector.replicaCount }}
selector:
matchLabels:
{{- include "honeycomb-observability-pipeline.collector.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
{{- include "honeycomb-observability-pipeline.collector.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: collector
spec:
serviceAccountName: {{ include "honeycomb-observability-pipeline.collector.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.collector.image.repository }}:{{ .Values.collector.image.tag }}"
imagePullPolicy: {{ .Values.collector.image.pullPolicy }}
args:
- --config
- /etc/opampsupervisor/config.yaml
{{- with .Values.collector.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/opampsupervisor
volumes:
- name: config
configMap:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-collector
items:
- key: config
path: config.yaml
{{- end }}
16 changes: 16 additions & 0 deletions charts/observability-pipeline/templates/collector-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if and .Values.collector.enabled .Values.collector.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-collector
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.collector.labels" . | nindent 4 }}
app.kubernetes.io/component: collector
spec:
type: ClusterIP
ports:
{{- toYaml .Values.collector.service.ports | nindent 4 }}
selector:
{{- include "honeycomb-observability-pipeline.collector.selectorLabels" . | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if and .Values.collector.enabled .Values.collector.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "honeycomb-observability-pipeline.collector.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.collector.labels" . | nindent 4 }}
app.kubernetes.io/component: collector
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-control-plane
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.labels" . | nindent 4 }}
{{- include "honeycomb-observability-pipeline.controlPlane.labels" . | nindent 4 }}
app.kubernetes.io/component: control-plane
data:
otel-config: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-control-plane
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.labels" . | nindent 4 }}
{{- include "honeycomb-observability-pipeline.controlPlane.labels" . | nindent 4 }}
app.kubernetes.io/component: control-plane
spec:
replicas: 1
selector:
matchLabels:
{{- include "honeycomb-observability-pipeline.selectorLabels" . | nindent 6 }}
{{- include "honeycomb-observability-pipeline.controlPlane.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
template:
metadata:
labels:
{{- include "honeycomb-observability-pipeline.selectorLabels" . | nindent 8 }}
{{- include "honeycomb-observability-pipeline.controlPlane.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: control-plane
spec:
serviceAccountName: {{ include "honeycomb-observability-pipeline.serviceAccountName" . }}
serviceAccountName: {{ include "honeycomb-observability-pipeline.controlPlane.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.controlPlane.image.repository }}:{{ .Values.controlPlane.image.tag }}"
Expand Down Expand Up @@ -60,6 +60,9 @@ spec:
- name: config
containerPort: 4321
protocol: TCP
- name: opamp
containerPort: 4320
protocol: TCP
{{- if or .Values.controlPlane.volumeMounts .Values.controlPlane.telemetry.enabled }}
volumes:
{{- if .Values.controlPlane.telemetry.enabled }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ include "honeycomb-observability-pipeline.fullname" . }}-control-plane
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.labels" . | nindent 4 }}
{{- include "honeycomb-observability-pipeline.controlPlane.labels" . | nindent 4 }}
app.kubernetes.io/component: control-plane
spec:
type: ClusterIP
Expand All @@ -14,6 +14,10 @@ spec:
targetPort: "config"
protocol: TCP
name: config
- port: 4320
targetPort: "opamp"
protocol: TCP
name: opamp
selector:
{{- include "honeycomb-observability-pipeline.selectorLabels" . | nindent 4 }}
{{- include "honeycomb-observability-pipeline.controlPlane.selectorLabels" . | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "honeycomb-observability-pipeline.serviceAccountName" . }}
name: {{ include "honeycomb-observability-pipeline.controlPlane.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "honeycomb-observability-pipeline.labels" . | nindent 4 }}
{{- include "honeycomb-observability-pipeline.controlPlane.labels" . | nindent 4 }}
app.kubernetes.io/component: control-plane
{{- end }}
25 changes: 25 additions & 0 deletions charts/observability-pipeline/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ controlPlane:
protocol: http/protobuf
endpoint: http://{{ include "honeycomb-observability-pipeline.name" . }}-otelcol-deployment:4318

collector:
enabled: true
serviceAccount:
create: true
name: ""
service:
enabled: true
ports:
- name: otlp
port: 4317
targetPort: 4317
protocol: TCP
appProtocol: grpc
- name: otlp-http
port: 4318
targetPort: 4318
protocol: TCP
resources: {}
replicaCount: 2
image:
repository: ""
pullPolicy: IfNotPresent
tag: ""


otelcol-deployment:
enabled: false
mode: deployment
Expand Down

0 comments on commit 9ed8204

Please sign in to comment.