Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion 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.9.6
version: 0.9.7


dependencies:
Expand Down
7 changes: 4 additions & 3 deletions charts/nr-k8s-otel-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ to export data to this connector which can then be connected to the New Relic ma
| 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` |
| exporters | string | `nil` | Define custom exporters here. See: https://opentelemetry.io/docs/collector/configuration/#exporters |
| image.pullPolicy | string | `"IfNotPresent"` | The pull policy is defaulted to IfNotPresent, which skips pulling an image if it already exists. If pullPolicy is defined without a specific value, it is also set to Always. |
| image.repository | string | `"newrelic/nrdot-collector-k8s"` | OTel collector image to be deployed. You can use your own collector as long it accomplish the following requirements mentioned below. |
| image.tag | string | `"1.5.0"` | Overrides the image tag whose default is the chart appVersion. |
| images | object | `{"collector":{"pullPolicy":"IfNotPresent","registry":"","repository":"newrelic/nrdot-collector-k8s","tag":"1.5.0"},"kubectl":{"pullPolicy":"IfNotPresent","registry":"","repository":"bitnami/kubectl","tag":"latest"},"pullSecrets":[]}` | Images used by the chart. |
| images.collector | object | `{"pullPolicy":"IfNotPresent","registry":"","repository":"newrelic/nrdot-collector-k8s","tag":"1.5.0"}` | Image for the OpenTelemetry Collector. |
| images.kubectl | object | `{"pullPolicy":"IfNotPresent","registry":"","repository":"bitnami/kubectl","tag":"latest"}` | Image for the initContainer that retrieves node allocatable resources. |
| images.pullSecrets | list | `[]` | The secrets that are needed to pull images from a custom registry. |
| kube-state-metrics.enableResourceQuotaSamples | bool | `false` | Enable resource quota data exporting |
| kube-state-metrics.enabled | bool | `true` | Install the [`kube-state-metrics` chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics) from the stable helm charts repository. This is mandatory if `infrastructure.enabled` is set to `true` and the user does not provide its own instance of KSM version >=1.8 and <=2.0. Note, kube-state-metrics v2+ disables labels/annotations metrics by default. You can enable the target labels/annotations metrics to be monitored by using the metricLabelsAllowlist/metricAnnotationsAllowList options described [here](https://github.com/prometheus-community/helm-charts/blob/159cd8e4fb89b8b107dcc100287504bb91bf30e0/charts/kube-state-metrics/values.yaml#L274) in your Kubernetes clusters. |
| kube-state-metrics.metricAnnotationsAllowList | list | `["pods=[*]", "namespaces=[*]", "deployments=[*]"]` | List of Kubernetes annotation keys that will be used in the resources' annotations metric. By default, kube-state-metrics v2+ does not expose annotations as metric labels. This option allows you to specify which annotations should be exposed as metric dimensions. Each entry is formatted as "resource=[annotation1,annotation2,...]". Use "*" to include all annotations for a resource type. Example: ["pods=[description,owner]", "namespaces=[description]", "deployments=[change-id,jira-ticket]"] |
Expand Down
2 changes: 0 additions & 2 deletions charts/nr-k8s-otel-collector/collector.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,3 @@ EU
headers:
api-key: <<NR api key>
```


Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
subjects:
- kind: ServiceAccount
name: nr-k8s-otel-collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
data:
daemonset-config.yaml: |
receivers:
Expand Down Expand Up @@ -605,7 +605,7 @@ data:
value: <cluser_name>
- key: "newrelic.chart.version"
action: upsert
value: 0.9.6
value: 0.9.7
- key: newrelic.entity.type
action: upsert
value: "k8s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
spec:
selector:
matchLabels:
Expand All @@ -24,12 +24,13 @@ spec:
app.kubernetes.io/name: nr-k8s-otel-collector
component: daemonset
annotations:
checksum/config: 6c393dbeeeb8b55c3da8659d412cfe48444e0047f0988787e14afd0292e00dc4
checksum/config: dddebd4fdd4de1850611c50ea1e781a30c5fe67156ef3d602cc64f03501a01d1
spec:
serviceAccountName: nr-k8s-otel-collector
initContainers:
- name: get-cpu-allocatable
image: bitnami/kubectl:latest
image: "bitnami/kubectl:latest"
imagePullPolicy: IfNotPresent
command:
- sh
- -c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
data:
deployment-config.yaml: |
receivers:
Expand Down Expand Up @@ -516,7 +516,7 @@ data:
value: <cluser_name>
- key: "newrelic.chart.version"
action: upsert
value: 0.9.6
value: 0.9.7
- key: newrelic.entity.type
action: upsert
value: "k8s"
Expand All @@ -534,7 +534,7 @@ data:
value: <cluser_name>
- key: "newrelic.chart.version"
action: upsert
value: 0.9.6
value: 0.9.7

transform/events:
log_statements:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
spec:
replicas: 1
minReadySeconds: 5
Expand All @@ -26,7 +26,7 @@ spec:
app.kubernetes.io/name: nr-k8s-otel-collector
component: deployment
annotations:
checksum/config: ca6b21baf629a91df39d33fe47590c1664987620a0efb9c0f2c797c8a3fb5dd1
checksum/config: 23c604532ee14493c0650bc5467c280096f3d3caec1c54961821e7728422ba9e
spec:
serviceAccountName: nr-k8s-otel-collector
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
data:
licenseKey: PE5SX2xpY2Vuc2VLZXk+
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
spec:
type: ClusterIP
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ metadata:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nr-k8s-otel-collector
app.kubernetes.io/version: 1.2.0
helm.sh/chart: nr-k8s-otel-collector-0.9.6
helm.sh/chart: nr-k8s-otel-collector-0.9.7
annotations:
9 changes: 9 additions & 0 deletions charts/nr-k8s-otel-collector/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if (.Values.image).repository }}
WARNING: 'image.repository' is deprecated and will be removed in a future release. Please use 'images.collector.repository' instead.
{{- end }}
{{- if (.Values.image).tag }}
WARNING: 'image.tag' is deprecated and will be removed in a future release. Please use 'images.collector.tag' instead.
{{- end }}
{{- if (.Values.image).pullPolicy }}
WARNING: 'image.pullPolicy' is deprecated and will be removed in a future release. Please use 'images.collector.pullPolicy' instead.
{{- end }}
21 changes: 21 additions & 0 deletions charts/nr-k8s-otel-collector/templates/_images.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- /*
Temporary image helper to transition from old image config structure to new structure.
*/ -}}
{{- define "nrKubernetesOtel.images.collector.image" }}
{{- if or (.Values.image).repository (.Values.image).tag }}
{{- (.Values.image).repository | default .Values.images.collector.repository }}:{{- (.Values.image).tag | default .Chart.AppVersion }}
{{- else }}
{{- include "newrelic.common.images.image" ( dict "imageRoot" .Values.images.collector "context" .) }}
{{- end }}
{{- end }}

{{- /*
Temporary imagePullPolicy helper to transition from old image config structure to new structure.
*/ -}}
{{- define "nrKubernetesOtel.images.collector.imagePullPolicy" }}
{{- if (.Values.image).pullPolicy }}
{{- .Values.image.pullPolicy }}
{{- else }}
{{- .Values.images.collector.pullPolicy }}
{{- end }}
{{- end }}
11 changes: 8 additions & 3 deletions charts/nr-k8s-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with include "newrelic.common.images.renderPullSecrets" ( dict "pullSecrets" (list .Values.images.pullSecrets) "context" .) }}
imagePullSecrets:
{{- . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}
{{- with include "nrKubernetesOtel.daemonset.securityContext.pod" . }}
securityContext:
Expand All @@ -36,7 +40,8 @@ spec:
{{- end }}
initContainers:
- name: get-cpu-allocatable
image: bitnami/kubectl:latest
image: {{ include "newrelic.common.images.image" ( dict "imageRoot" .Values.images.kubectl "context" .) }}
imagePullPolicy: {{ .Values.images.kubectl.pullPolicy }}
command:
- sh
- -c
Expand Down Expand Up @@ -89,8 +94,8 @@ spec:
securityContext:
{{- . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: {{ include "nrKubernetesOtel.images.collector.image" . }}
imagePullPolicy: {{ include "nrKubernetesOtel.images.collector.imagePullPolicy" . }}
args:
{{- include "nrKubernetesOtel.daemonset.args" . | nindent 12 }}
resources:
Expand Down
8 changes: 6 additions & 2 deletions charts/nr-k8s-otel-collector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with include "newrelic.common.images.renderPullSecrets" ( dict "pullSecrets" (list .Values.images.pullSecrets) "context" .) }}
imagePullSecrets:
{{- . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}
{{- with include "nrKubernetesOtel.deployment.securityContext.pod" . }}
securityContext:
Expand All @@ -42,8 +46,8 @@ spec:
securityContext:
{{- . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: {{ include "nrKubernetesOtel.images.collector.image" . }}
imagePullPolicy: {{ include "nrKubernetesOtel.images.collector.imagePullPolicy" . }}
args:
{{- include "nrKubernetesOtel.deployment.args" . | nindent 12 }}
resources:
Expand Down
129 changes: 124 additions & 5 deletions charts/nr-k8s-otel-collector/tests/images_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@ release:
name: my-release
namespace: my-namespace
tests:
- it: loads image and version from deprecated config
set:
cluster: my-cluster
licenseKey: us-whatever
image:
repository: nr/dot
pullPolicy: Always
tag: "1.1.1"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: nr/dot:1.1.1
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].image
value: nr/dot:1.1.1
template: templates/daemonset.yaml
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
template: templates/daemonset.yaml
- it: has a default image tag
set:
cluster: my-cluster
Expand All @@ -21,14 +46,15 @@ tests:
path: spec.template.spec.containers[0].image
pattern: ".*nil.*"
template: templates/daemonset.yaml
- it: loads image and version
- it: loads collector and version
set:
cluster: my-cluster
licenseKey: us-whatever
image:
repository: nr/dot
pullPolicy: Always
tag: "1.1.1"
images:
collector:
repository: nr/dot
tag: "1.1.1"
pullPolicy: Always
asserts:
- equal:
path: spec.template.spec.containers[0].image
Expand All @@ -45,4 +71,97 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
template: templates/daemonset.yaml
- it: loads kubectl image with registry
set:
cluster: my-cluster
licenseKey: us-whatever
images:
kubectl:
registry: my.registry.io
repository: custom/kubectl
tag: "1.28"
pullPolicy: Always
asserts:
- equal:
path: spec.template.spec.initContainers[0].image
value: my.registry.io/custom/kubectl:1.28
template: templates/daemonset.yaml
- equal:
path: spec.template.spec.initContainers[0].imagePullPolicy
value: Always
template: templates/daemonset.yaml
- it: uses registry for collector image
set:
cluster: my-cluster
licenseKey: us-whatever
images:
collector:
registry: ecr.aws.io
repository: newrelic/nrdot-collector-k8s
tag: "1.5.0"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: ecr.aws.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].image
value: ecr.aws.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/daemonset.yaml
- it: supports imagePullSecrets
set:
cluster: my-cluster
licenseKey: us-whatever
images:
pullSecrets:
- name: my-ecr-secret
- name: another-secret
asserts:
- equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-ecr-secret
- name: another-secret
template: templates/deployment.yaml
- equal:
path: spec.template.spec.imagePullSecrets
value:
- name: my-ecr-secret
- name: another-secret
template: templates/daemonset.yaml
- it: supports global registry
set:
cluster: my-cluster
licenseKey: us-whatever
global:
images:
registry: global.registry.io
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: global.registry.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].image
value: global.registry.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/daemonset.yaml
- it: local registry overrides global registry
set:
cluster: my-cluster
licenseKey: us-whatever
global:
images:
registry: global.registry.io
images:
collector:
registry: local.registry.io
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: local.registry.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].image
value: local.registry.io/newrelic/nrdot-collector-k8s:1.5.0
template: templates/daemonset.yaml
Loading
Loading