Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LS-59631] add opamp bridge to otel-cloud-stack chart #76

Merged
merged 26 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f1f5abf
add opamp bridge to otel-cloud-stack chart
jdcrouse Mar 13, 2024
cc6bc7a
undo some unintended changes
jdcrouse Mar 13, 2024
5971232
based on semver this seems like a new minor version
jdcrouse Mar 13, 2024
dd0d33b
go ahead and add the same chart to kube-otel-stack
jdcrouse Mar 13, 2024
0be699c
bump minor version
jdcrouse Mar 13, 2024
79a2dac
fix auth header variable
jdcrouse Mar 13, 2024
e15ca46
pull variable from secrets
jdcrouse Mar 13, 2024
29a79b0
new lines
jdcrouse Mar 14, 2024
681ccd5
fix variable substitution and include labels from values in collector…
jdcrouse Mar 14, 2024
3238621
fix variable subs and add labels to collectors
jdcrouse Mar 14, 2024
57088c2
optional label inclusion
jdcrouse Mar 14, 2024
502cb33
opamp-reporting prevents bridge modification of a collector, this val…
jdcrouse Mar 15, 2024
b62dcb9
set opampManaged as a collector attribute, and read that to optionall…
jdcrouse Mar 15, 2024
6680c57
same change to use an attribute instead of custom labels in kube-otel…
jdcrouse Mar 15, 2024
4ad3269
default opamp managd to true
jdcrouse Mar 15, 2024
d3ffea5
include opamp-reporting too, and set reporting default true managed d…
jdcrouse Mar 15, 2024
56b840a
pin to latest version tag
jdcrouse Mar 15, 2024
5d752cc
only set one of reporting or managed, giving reporting precedence
jdcrouse Mar 15, 2024
fbe14b9
whitespace
jdcrouse Mar 15, 2024
caced3d
merge in most of bridge chart from otel helm charts repo
jdcrouse Mar 15, 2024
71285ae
all or nothing opamp managed and reporting tags
jdcrouse Mar 15, 2024
69f8dbc
undo kube-otel-stack changes to slim down PR. these charts will be th…
jdcrouse Mar 15, 2024
8a5d135
idk
jdcrouse Mar 15, 2024
ac9580a
properly revert
jdcrouse Mar 15, 2024
1c15374
revert
jdcrouse Mar 15, 2024
4f90e6d
remove erroneous bridge
jdcrouse Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/otel-cloud-stack/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: "0.3.1"
version: "0.4.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes
MINOR version when you add functionality in a backward compatible manner
PATCH version when you make backward compatible bug fixes

this is adding functionality in a backward compatible manner so i increased the minor version


# 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
43 changes: 43 additions & 0 deletions charts/otel-cloud-stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,46 @@ heritage: {{ $.Release.Service | quote }}
{{- $userValue := index . 3 -}}
{{- include "otel-cloud-stack.kubeVersionDefaultValue" (list $values ">= 1.23-0" $insecure $secure $userValue) -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "opentelemetry-opamp-bridge.fullname" -}}
{{- if .fullnameOverride }}
{{- .fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.opAMPBridge.name }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "opentelemetry-collector.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Create the name of the clusterRole to use for the opampbridge
*/}}
{{- define "opentelemetry-opamp-bridge.clusterRoleName" -}}
{{- printf "%s-bridge" .Release.Name }}
{{- end }}
184 changes: 184 additions & 0 deletions charts/otel-cloud-stack/templates/bridge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{{- if .Values.opAMPBridge.enabled }}
apiVersion: opentelemetry.io/v1alpha1
kind: OpAMPBridge
metadata:
name: {{ include "opentelemetry-opamp-bridge.fullname" . }}
labels:
{{- include "otel-cloud-stack.labels" $ | indent 4 }}
{{- with $.Values.opAMPBridge.labels }}
{{- range $key, $value := . }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- end }}
{{- with $.Values.opAMPBridge.annotations }}
annotations:
{{- range $key, $value := . }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if $.Values.opAMPBridge.endpoint }}
endpoint: {{ $.Values.opAMPBridge.endpoint }}
{{- end }}
{{- with $.Values.opAMPBridge.headers }}
headers:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $.Values.opAMPBridge.capabilities }}
capabilities:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $.Values.opAMPBridge.componentsAllowed }}
componentsAllowed:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $.Values.opAMPBridge.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4}}
{{- end }}
{{- if $.Values.opAMPBridge.replicas }}
replicas: {{ $.Values.opAMPBridge.replicas }}
{{- end }}
{{- if $.Values.opAMPBridge.serviceAccount }}
serviceAccount: {{ $.Values.opAMPBridge.serviceAccount }}
{{- end }}
{{- if $.Values.opAMPBridge.image.digest }}
image: "{{ $.Values.opAMPBridge.image.repository }}@{{ $.Values.opAMPBridge.image.digest }}"
{{- else }}
image: "{{ $.Values.opAMPBridge.image.repository }}:{{ $.Values.opAMPBridge.image.tag | default $.Chart.AppVersion }}"
{{- end }}
{{- if $.Values.opAMPBridge.upgradeStrategy }}
upgradeStrategy: {{ $.Values.opAMPBridge.upgradeStrategy }}
{{- end }}
{{- if $.Values.opAMPBridge.imagePullPolicy }}
imagePullPolicy: {{ $.Values.opAMPBridge.imagePullPolicy }}
{{- end }}
{{- if $.Values.opAMPBridge.hostNetwork }}
hostNetwork: {{ $.Values.opAMPBridge.hostNetwork }}
{{- end }}
{{- if $.Values.opAMPBridge.priorityClassName }}
priorityClassName: {{ $.Values.opAMPBridge.priorityClassName }}
{{- end }}
{{- with $.Values.opAMPBridge.securityContext }}
securityContext:
{{- toYaml . | nindent 4}}
{{- end }}
{{- with $.Values.opAMPBridge.podAnnotations }}
podAnnotations:
{{- toYaml . | nindent 4}}
{{- end }}
{{- with $.Values.opAMPBridge.resources }}
resources:
{{- toYaml . | nindent 4}}
{{- end }}
{{- with $.Values.opAMPBridge.affinity }}
affinity:
{{- toYaml . | nindent 4}}
{{- end }}
{{- if $.Values.opAMPBridge.tolerations }}
tolerations:
{{- with $.Values.opAMPBridge.tolerations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if $.Values.opAMPBridge.volumes }}
volumes:
{{- with $.Values.opAMPBridge.volumes }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if $.Values.opAMPBridge.topologySpreadConstraints }}
topologySpreadConstraints:
{{- with $.Values.opAMPBridge.topologySpreadConstraints }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if $.Values.opAMPBridge.volumeMounts }}
volumeMounts:
{{- with $.Values.opAMPBridge.volumeMounts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if $.Values.opAMPBridge.ports }}
ports:
{{- with $.Values.opAMPBridge.ports }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
env:
{{- with $.Values.extraEnvs }}
{{- toYaml . | nindent 4 }}
{{- end }}
- name: OTEL_K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: OTEL_K8S_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OTEL_K8S_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OTEL_K8S_POD_UID
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.uid
- name: OTEL_K8S_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: OTEL_RESOURCE_ATTRIBUTES
value: "k8s.cluster.name={{ $.Values.clusterName }}"
{{- with $.Values.opAMPBridge.env }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $.Values.opAMPBridge.envFrom }}
envFrom:
{{- with $.Values.opAMPBridge.envFrom }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "opentelemetry-opamp-bridge.clusterRoleName" . }}
rules:
- apiGroups:
- opentelemetry.io
resources:
- opentelemetrycollectors
verbs:
- "*"
- apiGroups:
- ""
resources:
- pods
verbs:
- 'list'
- 'get'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "opentelemetry-opamp-bridge.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "{{ include "opentelemetry-opamp-bridge.clusterRoleName" . }}"
subjects:
- kind: ServiceAccount
# quirk of the Operator
{{- if $.Values.opAMPBridge.serviceAccount }}
name: "{{ $.Values.opAMPBridge.serviceAccount }}"
{{- else }}
name: "{{ (include "opentelemetry-opamp-bridge.fullname" .) }}-opamp-bridge"
{{- end }}
namespace: "{{ $.Release.Namespace }}"
{{- end }}
5 changes: 5 additions & 0 deletions charts/otel-cloud-stack/templates/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ metadata:
{{- end }}
labels:
app: {{ $collectorName }}
{{- if and $.Values.opAMPBridge.enabled $.Values.opAMPBridge.addReportingLabel }}
opentelemetry.io/opamp-reporting: "true"
{{- else if and $.Values.opAMPBridge.enabled $.Values.opAMPBridge.addManagedLabel }}
opentelemetry.io/opamp-managed: "true"
{{- end }}
{{- include "otel-cloud-stack.labels" $ | indent 4 }}
spec:
{{- if $collector.nodeSelector }}
Expand Down
31 changes: 31 additions & 0 deletions charts/otel-cloud-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -737,3 +737,34 @@ logsCollector:
exporters: [otlp]

collectors: []

opAMPBridge:
jdcrouse marked this conversation as resolved.
Show resolved Hide resolved
enabled: false
# Adds `opentelemetry.io/opamp-reporting: true` to all collectors
addReportingLabel: true
# Adds `opentelemetry.io/opamp-managed: true` to all collectors
addManagedLabel: false
image:
repository: ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge
tag: "0.96.0"
endpoint: "wss://opamp.lightstep.com/v1/opamp"
headers:
"Authorization": "bearer ${LS_OPAMP_API_KEY}"
env:
- name: LS_OPAMP_API_KEY
valueFrom:
secretKeyRef:
key: LS_OPAMP_API_KEY
name: otel-opamp-bridge-secret
capabilities:
AcceptsOpAMPConnectionSettings: true
AcceptsOtherConnectionSettings: true
AcceptsRemoteConfig: true
AcceptsRestartCommand: true
ReportsEffectiveConfig: true
ReportsHealth: true
ReportsOwnLogs: true
ReportsOwnMetrics: true
ReportsOwnTraces: true
ReportsRemoteConfig: true
ReportsStatus: true
Loading