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

[nr-k8s-otel-collector] Add DaemonSet and Deployment container port configuration options #1647

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions charts/nr-k8s-otel-collector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.8.4
version: 0.8.5

dependencies:
- name: common-library
Expand All @@ -32,7 +32,7 @@ dependencies:
# 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: "0.8.0"
appVersion: "0.8.3"

maintainers:
- name: csongnr
Expand Down
2 changes: 2 additions & 0 deletions charts/nr-k8s-otel-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ gkeAutopilot: false
| daemonset.nodeSelector | object | `{}` | Sets daemonset pod node selector. Overrides `nodeSelector` and `global.nodeSelector` |
| daemonset.podAnnotations | object | `{}` | Annotations to be added to the daemonset. |
| daemonset.podSecurityContext | object | `{}` | Sets security context (at pod level) for the daemonset. Overrides `podSecurityContext` and `global.podSecurityContext` |
| daemonset.ports | object | `{}` | Container ports to be added to the Daemonset. |
| daemonset.resources | object | `{}` | Sets resources for the daemonset. |
| daemonset.tolerations | list | `[]` | Sets daemonset pod tolerations. Overrides `tolerations` and `global.tolerations` |
| deployment.affinity | object | `{}` | Sets deployment pod affinities. Overrides `affinity` and `global.affinity` |
Expand All @@ -97,6 +98,7 @@ gkeAutopilot: false
| deployment.nodeSelector | object | `{}` | Sets deployment pod node selector. Overrides `nodeSelector` and `global.nodeSelector` |
| deployment.podAnnotations | object | `{}` | Annotations to be added to the deployment. |
| deployment.podSecurityContext | object | `{}` | Sets security context (at pod level) for the deployment. Overrides `podSecurityContext` and `global.podSecurityContext` |
| deployment.ports | object | `{}` | Container ports to be added to the Deployment. |
| deployment.resources | object | `{}` | Sets resources for the deployment. |
| deployment.tolerations | list | `[]` | Sets deployment pod tolerations. Overrides `tolerations` and `global.tolerations` |
| dnsConfig | object | `{}` | Sets pod's dnsConfig. Can be configured also with `global.dnsConfig` |
Expand Down
23 changes: 23 additions & 0 deletions charts/nr-k8s-otel-collector/templates/_ports.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{/* Build the list of port for the DaemonSet pods */}}
{{- define "nrKubernetesOtel.daemonset.ports" -}}
{{- $ports := deepCopy .Values.daemonset.ports -}}
{{- range $key, $port := $ports }}
{{- if $port.enabled }}
- name: {{ $key }}
containerPort: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
{{- end}}
{{- end }}
{{- end }}

{{/* Build the list of port for the Deployment pod */}}
{{- define "nrKubernetesOtel.deployment.ports" -}}
{{- $ports := deepCopy .Values.deployment.ports -}}
{{- range $key, $port := $ports }}
{{- if $port.enabled }}
- name: {{ $key }}
containerPort: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
{{- end}}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/nr-k8s-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ spec:
{{- with .Values.daemonset.envs }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- $ports := include "nrKubernetesOtel.daemonset.ports" .}}
{{- if $ports }}
ports:
{{- $ports | indent 12 }}
{{- end }}
volumeMounts:
{{- if not .Values.gkeAutopilot }}
- name: host-fs
Expand Down
7 changes: 4 additions & 3 deletions charts/nr-k8s-otel-collector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ spec:
{{- with .Values.deployment.envs }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- $ports := include "nrKubernetesOtel.deployment.ports" .}}
{{- if $ports }}
ports:
- name: http
containerPort: 4318
protocol: TCP
{{- $ports | indent 12 }}
{{- end }}
volumeMounts:
- name: deployment-config
mountPath: /config
Expand Down
30 changes: 29 additions & 1 deletion charts/nr-k8s-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,21 @@ daemonset:
# -- Sets additional environment variable sources for the daemonset.
envsFrom: []
# -- Settings for daemonset configmap
# @default -- See `values.yaml`
# @default -- See `values.yaml`\
ports:
metrics:
enabled: true
containerPort: 8888
servicePort: 8888
Copy link
Contributor

Choose a reason for hiding this comment

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

servicePort is being ignored by the tpl function. Do we need to support this parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

protocol: TCP
http:
enabled: true
containerPort: 4318
protocol: TCP
grpc:
enabled: true
containerPort: 4317
protocol: TCP
configMap:
# -- OpenTelemetry config for the daemonset. If set, overrides default config and disables configuration parameters for the daemonset.
config: {}
Expand All @@ -90,6 +104,20 @@ deployment:
envsFrom: []
# -- Settings for deployment configmap
# @default -- See `values.yaml`
ports:
metrics:
enabled: true
containerPort: 8888
servicePort: 8888
protocol: TCP
http:
enabled: true
containerPort: 4318
protocol: TCP
grpc:
enabled: true
containerPort: 4317
protocol: TCP
configMap:
# -- OpenTelemetry config for the deployment. If set, overrides default config and disables configuration parameters for the deployment.
config: {}
Expand Down
Loading