Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
21 changes: 21 additions & 0 deletions charts/opentelemetry-collector/ci/daemonset-openkruise-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mode: daemonset

image:
repository: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s"

command:
name: "otelcol-k8s"

resources:
limits:
cpu: 100m
memory: 200M

daemonset:
apiVersion: apps.kruise.io/v1alpha1

rollout:
strategy: RollingUpdate
rollingUpdate:
maxUnavailable: 1
partition: 0
1 change: 1 addition & 0 deletions charts/opentelemetry-collector/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Here is a collection of common configurations for the OpenTelemetry collector. Each folder contains an example `values.yaml` and the resulting configurations that are generated by the opentelemetry-collector helm charts.

- [Daemonset only](daemonset-only)
- [Daemonset with OpenKruise](daemonset-openkruise)
- [Deployment only](deployment-only)
- [Daemonset and deployment](daemonset-and-deployment)
- [Log collection, including collector logs](daemonset-collector-logs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
# Source: opentelemetry-collector/templates/configmap-agent.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: example-opentelemetry-collector-agent
namespace: default
labels:
helm.sh/chart: opentelemetry-collector-0.144.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.144.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: opentelemetry-collector
app.kubernetes.io/component: agent-collector
data:
relay: |
exporters:
debug: {}
extensions:
health_check:
endpoint: ${env:MY_POD_IP}:13133
processors:
batch: {}
memory_limiter:
check_interval: 5s
limit_percentage: 80
spike_limit_percentage: 25
receivers:
jaeger:
protocols:
grpc:
endpoint: ${env:MY_POD_IP}:14250
thrift_compact:
endpoint: ${env:MY_POD_IP}:6831
thrift_http:
endpoint: ${env:MY_POD_IP}:14268
otlp:
protocols:
grpc:
endpoint: ${env:MY_POD_IP}:4317
http:
endpoint: ${env:MY_POD_IP}:4318
prometheus:
config:
scrape_configs:
- job_name: opentelemetry-collector
scrape_interval: 10s
static_configs:
- targets:
- ${env:MY_POD_IP}:8888
zipkin:
endpoint: ${env:MY_POD_IP}:9411
service:
extensions:
- health_check
pipelines:
logs:
exporters:
- debug
processors:
- memory_limiter
- batch
receivers:
- otlp
metrics:
exporters:
- debug
processors:
- memory_limiter
- batch
receivers:
- otlp
- prometheus
traces:
exporters:
- debug
processors:
- memory_limiter
- batch
receivers:
- otlp
- jaeger
- zipkin
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: ${env:MY_POD_IP}
port: 8888
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# Source: opentelemetry-collector/templates/daemonset.yaml
apiVersion: apps.kruise.io/v1alpha1
kind: DaemonSet
metadata:
name: example-opentelemetry-collector-agent
namespace: default
labels:
helm.sh/chart: opentelemetry-collector-0.144.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.144.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: opentelemetry-collector
app.kubernetes.io/component: agent-collector
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
component: agent-collector
updateStrategy:
rollingUpdate:
maxUnavailable: 1
partition: 0
type: RollingUpdate
template:
metadata:
annotations:
checksum/config: d4535dacfefadbea526b1390f38ce6d3d6969ee590e0f0b3cfbdbc5587fef524

labels:
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
component: agent-collector

spec:

serviceAccountName: example-opentelemetry-collector
automountServiceAccountToken: true
securityContext:
{}
containers:
- name: opentelemetry-collector
command:
- /otelcol-k8s
args:
- --config=/conf/relay.yaml
securityContext:
{}
image: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s:0.144.0"
imagePullPolicy: IfNotPresent
ports:

- name: jaeger-compact
containerPort: 6831
protocol: UDP
hostPort: 6831
- name: jaeger-grpc
containerPort: 14250
protocol: TCP
hostPort: 14250
- name: jaeger-thrift
containerPort: 14268
protocol: TCP
hostPort: 14268
- name: otlp
containerPort: 4317
protocol: TCP
hostPort: 4317
- name: otlp-http
containerPort: 4318
protocol: TCP
hostPort: 4318
- name: zipkin
containerPort: 9411
protocol: TCP
hostPort: 9411
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
livenessProbe:
httpGet:
path: /
port: 13133
readinessProbe:
httpGet:
path: /
port: 13133
volumeMounts:
- mountPath: /conf
name: opentelemetry-collector-configmap
volumes:
- name: opentelemetry-collector-configmap
configMap:
name: example-opentelemetry-collector-agent
items:
- key: relay
path: relay.yaml
hostNetwork: false
hostPID: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Source: opentelemetry-collector/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: example-opentelemetry-collector
namespace: default
labels:
helm.sh/chart: opentelemetry-collector-0.144.0
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: example
app.kubernetes.io/version: "0.144.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: opentelemetry-collector
app.kubernetes.io/component: agent-collector
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mode: daemonset

image:
repository: "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-k8s"

command:
name: "otelcol-k8s"

daemonset:
apiVersion: apps.kruise.io/v1alpha1

rollout:
strategy: RollingUpdate
rollingUpdate:
maxUnavailable: 1
partition: 0
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if eq .Values.mode "daemonset" -}}
apiVersion: apps/v1
apiVersion: {{ .Values.daemonset.apiVersion | default "apps/v1" }}
kind: DaemonSet
metadata:
name: {{ include "opentelemetry-collector.fullname" . }}-agent
Expand Down
11 changes: 11 additions & 0 deletions charts/opentelemetry-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@
"properties": {
"rollingUpdate": {
"type": "object",
"additionalProperties": true,
"properties": {
"maxSurge": {
"$ref": "#/$defs/intOrString"
Expand Down Expand Up @@ -1135,6 +1136,16 @@
}
}
},
"daemonset": {
"type": "object",
"additionalProperties": false,
"properties": {
"apiVersion": {
"type": "string",
"description": "Override the default apiVersion for custom controllers or testing new API versions."
}
}
},
"networkPolicy": {
"type": "object",
"additionalProperties": false,
Expand Down
15 changes: 15 additions & 0 deletions charts/opentelemetry-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,14 @@ rollout:
# When 'mode: daemonset', maxSurge cannot be used when hostPort is set for any of the ports
# maxSurge: 25%
# maxUnavailable: 0
# Custom controllers like OpenKruise support additional rollingUpdate fields:
# rollingUpdate:
# maxUnavailable: 1
# partition: 0
# paused: false
# selector:
# matchLabels:
# app: example
strategy: RollingUpdate

prometheusRule:
Expand All @@ -664,6 +672,13 @@ statefulset:
whenDeleted: Retain
whenScaled: Retain

daemonset:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this nested under a daemonset section? Would it be applicable to other modes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In case of OpenKruise the same trick would work for StatefulSet but not for Deployment so I can add support for StatefulSet under a separate key like statefulset or we can move apiVersion to a top level variable and just fail when using a Deployment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it ever valid to have mode="deployment" and to set an API? If so, a root-level field would be nice.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Theoretically, if apps/v2 were to be released someday, it would allow for quick testing to see if the chart would work in its current state. However, at the moment, I don't know of a use case for it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@TylerHelmuth so should I just move it to the top level? The use case for mode="deployment" is a stretch but the code will be cleaner :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think top level apiVersion is the most future-proof solution.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@TylerHelmuth ok moved the variable to top level and added examples for other modes.

# Override the default apiVersion for custom controllers (e.g., OpenKruise)
# or for testing new API versions.
# If not set, defaults to "apps/v1".
# Example: apps.kruise.io/v1alpha1
apiVersion: ""

networkPolicy:
enabled: false

Expand Down