-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nr-k8s-otel-collector] - exposing pod EVs to configuration in values…
… file (#1489) <!-- Thank you for contributing to New Relic's Helm charts. Before you submit this PR we'd like to make sure you are aware of our technical requirements: * https://github.com/newrelic-experimental/helm-charts/blob/master/CONTRIBUTING.md#technical-requirements For a quick overview across what we will look at reviewing your PR, please read our review guidelines: * https://github.com/newrelic-experimental/helm-charts/blob/master/REVIEW_GUIDELINES.md Following our best practices right from the start will accelerate the review process and help get your PR merged quicker. When updates to your PR are requested, please add new commits and do not squash the history. This will make it easier to identify new changes. The PR will be squashed anyways when it is merged. Thanks. For fast feedback, please @-mention maintainers that are listed in the Chart.yaml file. Please make sure you test your changes before you push them. Once pushed, a Github Action will run across your changes and do some initial checks and linting. These checks run very quickly. Please check the results. We would like these checks to pass before we even continue reviewing your changes. --> #### Is this a new chart No. This is a modification to 'nr-otel-for-k8s', which is currently maintained by @csongnr and @dbudziwojskiNR #### What this PR does / why we need it: This PR exposes the option to add additional pod EVs to the deployment and daemonset running on kubernetes. I ran into a use case where I needed to be able to customize the 'nr-otel-for-k8s' service with a custom collector config, but once I did so I was unable to securely pass values to that config. In order to securely pass values to a custom config, having access from the values file to provide additional EVs is helpful. #### Checklist - [x] Chart Version bumped - [x] Variables are documented in the README.md - [x] Title of the PR starts with chart name (e.g. `[mychartname]`) --------- Co-authored-by: Daniel Budziwojski <dbudziwojski@newrelic.com>
- Loading branch information
1 parent
94402da
commit 87912b5
Showing
7 changed files
with
235 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
charts/nr-k8s-otel-collector/tests/env_vars_from_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
suite: envVarsFrom | ||
templates: | ||
- templates/deployment.yaml | ||
- templates/deployment-configmap.yaml | ||
- templates/daemonset.yaml | ||
- templates/daemonset-configmap.yaml | ||
release: | ||
name: my-release | ||
namespace: my-namespace | ||
tests: | ||
- it: does not set envFrom by default | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
asserts: | ||
- notExists: | ||
path: spec.template.spec.containers[0].envFrom | ||
template: templates/deployment.yaml | ||
- notExists: | ||
path: spec.template.spec.containers[0].envFrom | ||
template: templates/daemonset.yaml | ||
- it: adds additional deployment env sources from Values file using 'nr-otel-for-k8s-license' secret | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
deployment: | ||
envsFrom: | ||
- secretRef: | ||
name: test-secret-dep | ||
- configMapRef: | ||
name: test-configmap-dep | ||
asserts: | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
secretRef: | ||
name: test-secret-dep | ||
template: templates/deployment.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
configMapRef: | ||
name: test-configmap-dep | ||
template: templates/deployment.yaml | ||
- notExists: | ||
path: spec.template.spec.containers[0].envFrom | ||
template: templates/daemonset.yaml | ||
- it: adds additional daemonset env sources from Values file using 'nr-otel-for-k8s-license' secret | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
daemonset: | ||
envsFrom: | ||
- secretRef: | ||
name: test-secret-dae | ||
- configMapRef: | ||
name: test-configmap-dae | ||
asserts: | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
secretRef: | ||
name: test-secret-dae | ||
template: templates/daemonset.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
configMapRef: | ||
name: test-configmap-dae | ||
template: templates/daemonset.yaml | ||
- notExists: | ||
path: spec.template.spec.containers[0].envFrom | ||
template: templates/deployment.yaml | ||
- it: adds additional deployment and daemonset env sources from Values file using 'nr-otel-for-k8s-license' secret | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
deployment: | ||
envsFrom: | ||
- secretRef: | ||
name: test-secret-dep | ||
- configMapRef: | ||
name: test-configmap-dep | ||
daemonset: | ||
envsFrom: | ||
- secretRef: | ||
name: test-secret-dae | ||
- configMapRef: | ||
name: test-configmap-dae | ||
asserts: | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
secretRef: | ||
name: test-secret-dep | ||
template: templates/deployment.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
configMapRef: | ||
name: test-configmap-dep | ||
template: templates/deployment.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
secretRef: | ||
name: test-secret-dae | ||
template: templates/daemonset.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].envFrom | ||
content: | ||
configMapRef: | ||
name: test-configmap-dae | ||
template: templates/daemonset.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
suite: envVars | ||
templates: | ||
- templates/deployment.yaml | ||
- templates/deployment-configmap.yaml | ||
- templates/daemonset.yaml | ||
- templates/daemonset-configmap.yaml | ||
release: | ||
name: my-release | ||
namespace: my-namespace | ||
tests: | ||
- it: does not set pod environment variables by default | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
asserts: | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 3 | ||
template: templates/deployment.yaml | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 7 | ||
template: templates/daemonset.yaml | ||
- it: sets deployment pod environment variables from values | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
deployment: | ||
envs: | ||
- name: "TEST_DEP_ENV_VAR" | ||
value: "my-dep-value" | ||
asserts: | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 4 | ||
template: templates/deployment.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: "TEST_DEP_ENV_VAR" | ||
value: "my-dep-value" | ||
template: templates/deployment.yaml | ||
- it: sets daemonset pod environment variables from values | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
daemonset: | ||
envs: | ||
- name: "TEST_DAE_ENV_VAR" | ||
value: "my-dae-value" | ||
asserts: | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 8 | ||
template: templates/daemonset.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: "TEST_DAE_ENV_VAR" | ||
value: "my-dae-value" | ||
template: templates/daemonset.yaml | ||
- it: sets deployment and daemonset pod environment variables from values | ||
set: | ||
cluster: my-cluster | ||
licenseKey: us-whatever | ||
deployment: | ||
envs: | ||
- name: "TEST_DEP_ENV_VAR" | ||
value: "my-dep-value" | ||
daemonset: | ||
envs: | ||
- name: "TEST_DAE_ENV_VAR" | ||
value: "my-dae-value" | ||
asserts: | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 4 | ||
template: templates/deployment.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: "TEST_DEP_ENV_VAR" | ||
value: "my-dep-value" | ||
template: templates/deployment.yaml | ||
- lengthEqual: | ||
path: spec.template.spec.containers[0].env | ||
count: 8 | ||
template: templates/daemonset.yaml | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: "TEST_DAE_ENV_VAR" | ||
value: "my-dae-value" | ||
template: templates/daemonset.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters