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

feat: support a custom base URL for the new relic provider #1053

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

jemisonf
Copy link
Contributor

@jemisonf jemisonf commented Mar 29, 2021

Enables use of the provider by people accessing new relic via a proxy. Users should set either a region key or a base-url key in their new relic secret, and if neither is provided the provider will continue to default to the US region.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My builds are green. Try syncing with master if they are not.
  • My organization is added to USERS.md.

enables use of the provider by people accessing new relic
via a proxy

Signed-off-by: Fischer Jemison <fjemison@newrelic.com>
@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #1053 (347816f) into master (e803db0) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1053      +/-   ##
==========================================
+ Coverage   80.90%   81.01%   +0.10%     
==========================================
  Files         103      103              
  Lines        9104     9165      +61     
==========================================
+ Hits         7366     7425      +59     
- Misses       1244     1245       +1     
- Partials      494      495       +1     
Impacted Files Coverage Δ
metricproviders/newrelic/newrelic.go 92.00% <100.00%> (+0.69%) ⬆️
rollout/pause.go 95.09% <0.00%> (+1.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e803db0...347816f. Read the comment docs.

@jemisonf
Copy link
Contributor Author

Based on discussion in slack: https://argoproj.slack.com/archives/CKTN88XFH/p1616688533036100

I don't think there's a corresponding issue but I can open one if that would be helpful

@russellwhitaker
Copy link
Contributor

@jemisonf if you could associate an issue with this, yes, that would be great, thanks.

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

This looks good to go. Do you mind also documenting this as well?

@jemisonf
Copy link
Contributor Author

Taking some time to investigate if using $HTTP_PROXY is sufficient to solve this issue. If that's the case this can be just a docs PR.

Comment on lines 158 to 171
region := "us"
if _, ok := secret.Data["region"]; ok {
region = string(secret.Data["region"])
}
newrelicOptions = append(newrelicOptions, newrelic.ConfigRegion(region))

// base URL for the new relic REST API
if _, ok := secret.Data["base-url-rest"]; ok {
newrelicOptions = append(newrelicOptions, newrelic.ConfigBaseURL(string(secret.Data["base-url-rest"])))
}

// base URL for the nerdgraph (graphQL) API
if _, ok := secret.Data["base-url-nerdgraph"]; ok {
newrelicOptions = append(newrelicOptions, newrelic.ConfigNerdGraphBaseURL(string(secret.Data["base-url-nerdgraph"])))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a change from the original approach, based on reading the docs. Looks like we need to define separate REST API and NerdGraph (aka GraphQL) API base URLs in addition to the region.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are some other base URL config keys available but these are the only two that should be relevant for this specific application

Signed-off-by: Fischer Jemison <fjemison@newrelic.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 1, 2021

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
44.4% 44.4% Duplication

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

LGTM!

@jessesuen jessesuen merged commit 7509478 into argoproj:master Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants