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

[target-allocator] Exit on invalid config #1767

Merged

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented May 25, 2023

Target allocator should exit if its combined configuration is invalid. This change should've been part of #1729 .

@swiatekm swiatekm requested a review from a team May 25, 2023 08:23
Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

can we also add an e2e test in your awesome test suite for this?

@@ -76,6 +76,7 @@ func main() {

if validationErr := config.ValidateConfig(&cfg, &cliConf); validationErr != nil {
setupLog.Error(validationErr, "Invalid configuration")
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also fail fast above when we can't load the CLI config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already do, it was fixed in a different PR.

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

can we also add an e2e test in your awesome test suite for this?

@swiatekm
Copy link
Contributor Author

can we also add an e2e test in your awesome test suite for this?

I think so. It'd just be a blanket assertion that the containers don't start with some settings, but that should work as a smoke test.

@swiatekm swiatekm requested a review from a team May 25, 2023 15:40
@swiatekm
Copy link
Contributor Author

swiatekm commented May 25, 2023

Added a E2E test where target allocator is enabled, but PrometheusCR is disabled, and there aren't any scrape configs defined in prometheus receiver configuration. This is a valid Collector config, but an invalid Target Allocator config, so TA doesn't start.

I guess we should find a way to reject this at admission, but that requires parsing the prometheus config, which we'd rather not do. Maybe we should actually accept this configuration in TA and just do nothing instead?

@TylerHelmuth TylerHelmuth added the Skip Changelog PRs that do not require a CHANGELOG.md entry label May 25, 2023
@swiatekm swiatekm force-pushed the fix/ta-exit-on-invalid-config branch from 0b2aedb to afd4dce Compare May 25, 2023 16:48
@swiatekm
Copy link
Contributor Author

As per our discussion during the SIG, I've changed this so the TA only exits if it can't parse the config. If we don't have any scrape configs and no PrometheusCR, we still start, but do nothing. As we plan to reject this combination at admission in the future, I'm not adding an E2E test for it @jaronoff97 .

@openshift-ci
Copy link

openshift-ci bot commented Jul 12, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jaronoff97, swiatekm-sumo, TylerHelmuth

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot removed the lgtm label Jul 12, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jul 12, 2023

New changes are detected. LGTM label has been removed.

@swiatekm swiatekm force-pushed the fix/ta-exit-on-invalid-config branch from 202b8cc to 68a3a1b Compare July 13, 2023 09:16
@jaronoff97
Copy link
Contributor

@swiatekm-sumo are we good to merge this (after a rebase?)

@swiatekm swiatekm force-pushed the fix/ta-exit-on-invalid-config branch from 68a3a1b to 2ad8985 Compare November 29, 2023 10:12
@swiatekm swiatekm force-pushed the fix/ta-exit-on-invalid-config branch from 2ad8985 to fa46c0f Compare November 29, 2023 10:14
@swiatekm swiatekm requested a review from jaronoff97 November 29, 2023 10:16
@swiatekm
Copy link
Contributor Author

@jaronoff97 Yes, it's ready to be merged.

@jaronoff97 jaronoff97 merged commit 7ae1420 into open-telemetry:main Nov 29, 2023
27 checks passed
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants