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

Get Cloud Foundry application name from Cloud Controller API #7483

Merged
merged 10 commits into from
Mar 2, 2021

Conversation

zippolyte
Copy link
Contributor

What does this PR do?

Get a list of applications from the cloud controller API to get up to date names since the BBS API provided one never changes upon renames

Motivation

Useful for people using blue/green deployment scheme for their applications, making heavy use of renaming

Additional Notes

Anything else we should know when reviewing?

Describe your test plan

Unit tests and manual tests on lab environment

@zippolyte zippolyte requested review from a team as code owners February 19, 2021 15:33
@zippolyte zippolyte added this to the 7.27.0 milestone Feb 19, 2021
Copy link
Contributor

@sarina-dd sarina-dd left a comment

Choose a reason for hiding this comment

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

👍 YAML LGTM

@zippolyte zippolyte force-pushed the hippo/cccache branch 3 times, most recently from 2b7ccb2 to 0c5a349 Compare February 22, 2021 11:48
Copy link
Contributor

@therve therve left a comment

Choose a reason for hiding this comment

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

Looks great, a few nits and questions.

cmd/cluster-agent-cloudfoundry/app/app.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
pkg/config/config_template.yaml Outdated Show resolved Hide resolved
pkg/util/cloudfoundry/cccache.go Outdated Show resolved Hide resolved
pkg/util/cloudfoundry/cccache.go Outdated Show resolved Hide resolved
pkg/util/cloudfoundry/types.go Show resolved Hide resolved
@@ -83,7 +83,7 @@ func matchYAMLKey(key string) *regexp.Regexp {
// matchYAMLKeyEnding returns a regexp matching a single YAML line with a key ending by the string passed as argument.
// The returned regexp catches only the key and not the value.
func matchYAMLKeyEnding(ending string) *regexp.Regexp {
return regexp.MustCompile(fmt.Sprintf(`(\s*(\w|_)*%s\s*:).+`, ending))
return regexp.MustCompile(fmt.Sprintf(`(^\s*(\w|_)*%s\s*:).+`, ending))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that an intended change?

Copy link
Contributor Author

@zippolyte zippolyte Feb 23, 2021

Choose a reason for hiding this comment

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

Yes. Problem was that I can have an error message like failure to get oauth token: err here, which would end up redacted because this function is called with a token ending http://github.com/Datadog/datadog-agent/blob/0c5a349103ba5dc611c2e5b8f85e7c1fb8e9ba3c/pkg/util/log/strip.go#L57-L57.

Since the regex here is intended to match on yaml keys, I figured matching a beginning of line would not cause problems

pkg/config/config_template.yaml Outdated Show resolved Hide resolved
pkg/util/cloudfoundry/bbscache.go Outdated Show resolved Hide resolved
pkg/util/cloudfoundry/cccache.go Outdated Show resolved Hide resolved
@zippolyte zippolyte merged commit 1848e94 into master Mar 2, 2021
@zippolyte zippolyte deleted the hippo/cccache branch March 2, 2021 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants