-
Notifications
You must be signed in to change notification settings - Fork 210
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
[newrelic-logging] Allow setting a custom metrics endpoint to bypass the broken autodetection #1450
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes looks good. Can you please add unit tests in file: endpoint_region_selection_test.yaml
I am sharing few tests in addition to the existing ones. You can add more cases if you see the need. Add these tests to commit. If you want us to add the tests, we can add it from our side.
templates:
- templates/configmap.yaml
- templates/daemonset.yaml
- templates/daemonset-windows.yaml
release:
name: endpoint-selection-release
namespace: endpoint-selection-namespace
tests:
- it: selects staging endpoints if nrStaging is enabled
set:
licenseKey: nr_license_key
nrStaging: true
enableWindows: true
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://staging-log-api.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "staging-metric-api.newrelic.com"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://staging-log-api.newrelic.com/log/v1"
template: templates/daemonset-windows.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "staging-metric-api.newrelic.com"
template: templates/daemonset-windows.yaml
- it: selects US endpoints for a US license key
set:
licenseKey: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFFFFNRAL
enableWindows: true
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.newrelic.com"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.newrelic.com/log/v1"
template: templates/daemonset-windows.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.newrelic.com"
template: templates/daemonset-windows.yaml
- it: selects EU endpoints for a EU license key
set:
licenseKey: euaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFFFFNRAL
enableWindows: true
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.eu.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.eu.newrelic.com"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.eu.newrelic.com/log/v1"
template: templates/daemonset-windows.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.eu.newrelic.com"
template: templates/daemonset-windows.yaml
- it: selects custom logs endpoint if provided
set:
licenseKey: euaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFFFFNRAL
endpoint: custom
enableWindows: true
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "custom"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "custom"
template: templates/daemonset-windows.yaml
- it: selects user defined endpoint
set:
licenseKey: nr_license_key
nrStaging: false
enableWindows: true
metricsEndpoint: "https://user-defined-api.newrelic.com"
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "https://user-defined-api.newrelic.com"
template: templates/daemonset.yaml
- it: selects user-defined metrics endpoint even with EU license key
set:
licenseKey: euaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFFFFNRAL
enableWindows: true
metricsEndpoint: "https://user-defined-eu-metric-api.newrelic.com"
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.eu.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "https://user-defined-eu-metric-api.newrelic.com"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.eu.newrelic.com/log/v1"
template: templates/daemonset-windows.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "https://user-defined-eu-metric-api.newrelic.com"
template: templates/daemonset-windows.yaml
- it: selects default US metrics endpoint when metricsEndpoint is not provided and license key is not EU
set:
licenseKey: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFFFFNRAL
enableWindows: true
asserts:
# Linux
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.newrelic.com/log/v1"
template: templates/daemonset.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.newrelic.com"
template: templates/daemonset.yaml
# Windows
- contains:
path: spec.template.spec.containers[0].env
content:
name: ENDPOINT
value: "https://log-api.newrelic.com/log/v1"
template: templates/daemonset-windows.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: METRICS_HOST
value: "metric-api.newrelic.com"
template: templates/daemonset-windows.yaml ```
test cases Added in a new PR
Is this a new chart
No
What this PR does / why we need it:
Allows overriding the default metrics endpoint, as it's already possible for the logs endpoint
Which issue this PR fixes
_helpers.tpl
relies on plain value secret to choose EU over US #1399Special notes for your reviewer:
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
[mychartname]
)