pkg/prometheus: move LabelConfigValidator to validation package#8209
Merged
simonpasquier merged 1 commit intoprometheus-operator:mainfrom Dec 24, 2025
Conversation
tomlin7
added a commit
to tomlin7/prometheus-operator
that referenced
this pull request
Dec 24, 2025
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
ac2579a to
a733b75
Compare
tomlin7
added a commit
to tomlin7/prometheus-operator
that referenced
this pull request
Dec 24, 2025
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
a733b75 to
ce31087
Compare
tomlin7
added a commit
to tomlin7/prometheus-operator
that referenced
this pull request
Dec 24, 2025
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
ce31087 to
2219ffc
Compare
tomlin7
added a commit
to tomlin7/prometheus-operator
that referenced
this pull request
Dec 24, 2025
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
2219ffc to
67f1e7a
Compare
Contributor
|
Looks good but I'm going to revise my first comment since the goal of the issue was to move to the object to a different package so let's move it |
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
67f1e7a to
9a7bbe5
Compare
Arpit529Srivastava
pushed a commit
to Arpit529Srivastava/prometheus-operator
that referenced
this pull request
Jan 5, 2026
…etheus-operator#8209) This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files. The 'validate' method was renamed to 'ValidateRelabelConfig' to allow it to be tested and used from outside the package. Updated references in: - pkg/prometheus/resource_selector.go - pkg/prometheus/promcfg.go - pkg/prometheus/server/operator.go - pkg/prometheus/resource_selector_test.go Fixes: prometheus-operator#8209
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This move improves code organization and encapsulation by isolating validation logic from resource selection. It also resolves issues related to accessing private fields/methods across files.
The
validatemethod was renamed toValidateRelabelConfigto allow it to be tested and used from outside the package.Updated references in:
Closes: #7951
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
xin the box that apply.CHANGE(fix or feature that would cause existing functionality to not work as expected)FEATURE(non-breaking change which adds functionality)BUGFIX(non-breaking change which fixes an issue)ENHANCEMENT(non-breaking change which improves existing functionality)NONE(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Verification
Successfully ran
go test -v -run TestValidateRelabelConfig ./pkg/prometheus- all 29 passed.go test ./pkg/prometheus/validation(new package, no compilation issues).go build ./pkg/prometheus/server.Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.