Skip to content

Conversation

@nutmos
Copy link
Contributor

@nutmos nutmos commented Aug 16, 2025

Description

Due to the new feature introduced in the Prometheus 3.5.0, the field client_id under Azure AD Managed Identity in Remote Write is allowed to be the blank support system assigned managed identity. This PR changes the ClientID field to be optional and will place the empty string in the config when the field is not being set.

Fixes #7562

Type of change

  • 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

Unit Testing

Changelog entry

- Change the field azureAd.managedIdentity.clientID under RemoteWriteSpec to be the optional field.

@nutmos nutmos marked this pull request as ready for review August 18, 2025 11:03
@nutmos nutmos requested a review from a team as a code owner August 18, 2025 11:03
Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

I think that we need to update validateRemoteWriteSpec() (in pkg/prometheus/operator.go) to fail when the field is empty and we're on Prometheus < v3.5.0.

{Key: "client_id", Value: spec.AzureAD.ManagedIdentity.ClientID},
}},
)
if cg.version.GTE(semver.MustParse("3.5.0")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that we need to check the version here: the controller should have validated before that an empty client id is supported by the prometheus version. We should only check for nil-ness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simonpasquier Just want to confirm. I need to add the version check in validateRemoteWriteSpec() in pkg/prometheus/operator.go and just skip the version check here. Am I correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

correct!

@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 4, 2025
@nutmos
Copy link
Contributor Author

nutmos commented Oct 6, 2025

@simonpasquier Updated. Please review

@nutmos nutmos requested a review from simonpasquier October 6, 2025 12:16
// Reference:
// https://github.com/prometheus/prometheus/blob/main/docs/configuration/configuration.md#remote_write
func validateRemoteWriteSpec(spec monitoringv1.RemoteWriteSpec) error {
func validateRemoteWriteSpec(spec monitoringv1.RemoteWriteSpec, version semver.Version, componentName ComponentName) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

The way we do it currently is that fields which are not (yet) supported in Thanos are reset in pkg/thanos/operator.go to avoid "polluting" pkg/prometheus with dual concerns. It would be good to preserve this approach and move the validation to the Thanos controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simonpasquier Sure, will update it later.

@nutmos
Copy link
Contributor Author

nutmos commented Oct 18, 2025

@simonpasquier From my understanding, we should do the validation for this field in pkg/thanos/operator.go and reset it before calling the validation in pkg/prometheus, am I correct?

@nutmos
Copy link
Contributor Author

nutmos commented Nov 12, 2025

@simonpasquier Updated, please review and suggest. Thank you!

@simonpasquier simonpasquier force-pushed the feat/azure-relax-validate-client-id branch from e2af71c to 3d9dd4c Compare November 12, 2025 15:11
Signed-off-by: Simon Pasquier <[email protected]>
@simonpasquier simonpasquier force-pushed the feat/azure-relax-validate-client-id branch from 3d9dd4c to caebd98 Compare November 12, 2025 15:24
@nutmos nutmos requested a review from simonpasquier November 13, 2025 13:36
@nutmos
Copy link
Contributor Author

nutmos commented Nov 19, 2025

@simonpasquier thanks for updating the branch. Do you think it has anything else to do with this issue?

@simonpasquier
Copy link
Contributor

It's ready to merge but we need someone else than me to approve :)

@simonpasquier simonpasquier merged commit df692bf into prometheus-operator:main Nov 19, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relax validation on Azure clientID field

3 participants