opentelemetry-helm-charts
opentelemetry-helm-charts copied to clipboard
Collector Service is overwritten
I found an issue with the creation of the service object in Kubernetes. The service objects get overwritten when deployed from a deployment AND a daemonset.
We have a custom Helm chart that uses the collector helm as sub-chart twice to deploy the collector as agents and gateway.
Charts.yaml
apiVersion: v2
name: k8s_collector_service
description: A Helm chart for Kubernetes. It can be used to deploy OpenTelemetry Collectors and configure them from one place.
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.1.0
# 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2024.05.03"
dependencies:
- name: opentelemetry-collector
version: "^0.90.0"
repository: "@open-telemetry"
alias: collector-deployment
condition: collector-deployment.enabled
tags:
- deployment
- name: opentelemetry-collector
version: "^0.90.0"
repository: "@open-telemetry"
alias: collector-daemonset
condition: collector-daemonset.enabled
tags:
- daemonset
Here is an except of the 2 service.yaml files created by the helm chart:
kind: Service
apiVersion: v1
metadata:
name: collectors-otelcol
namespace: default
labels:
helm.sh/chart: collector-daemonset-0.90.1
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
app.kubernetes.io/version: "0.99.0"
app.kubernetes.io/managed-by: Helm
component: agent-collector
spec:
type: ClusterIP
ports:
...
selector:
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
component: agent-collector
internalTrafficPolicy: Local
kind: Service
apiVersion: v1
metadata:
name: collectors-otelcol
namespace: default
labels:
helm.sh/chart: collector-deployment-0.90.1
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
app.kubernetes.io/version: "0.99.0"
app.kubernetes.io/managed-by: Helm
component: standalone-collector
spec:
type: ClusterIP
ports:
...
selector:
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
component: standalone-collector
internalTrafficPolicy: Cluster
Both objects are created with the same name, effectively overwriting itself. A second object currently needs to be created manually. It needs to be give another name.
kind: Service
apiVersion: v1
metadata:
name: collectors-otelcol-agent
namespace: default
labels:
helm.sh/chart: collector-daemonset-0.90.1
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
app.kubernetes.io/version: "0.99.0"
app.kubernetes.io/managed-by: Helm
component: standalone-collector
spec:
type: ClusterIP
ports:
...
selector:
app.kubernetes.io/name: otelcol
app.kubernetes.io/instance: collectors
component: standalone-collector
internalTrafficPolicy: Cluster