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

fix: convert consul scheme to lowercase while setting prometheus config #6098

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

slashpai
Copy link
Contributor

Description

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.

Noticed while playing around ConsulSD config Scheme should be converted to lowercase to fix error unsupported protocol scheme \"HTTPS\"" from Prometheus

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in 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.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

fix: convert consul scheme to lowercase while setting prometheus config

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
@slashpai slashpai requested a review from a team as a code owner November 17, 2023 08:51
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.

There are a couple more places where we can do the same I believe.

@slashpai
Copy link
Contributor Author

There are a couple more places where we can do the same I believe.

The one on ScrapeConfigSpec is already taken care

if sc.Spec.Scheme != nil {
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: strings.ToLower(*sc.Spec.Scheme)})
}

I don't see scheme used in other ScrapeConfigs

@simonpasquier
Copy link
Contributor

if ep.Scheme != "" {
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: ep.Scheme})
}

if m.Spec.ProberSpec.Scheme != "" {
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: m.Spec.ProberSpec.Scheme})
}

if ep.Scheme != "" {
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: ep.Scheme})
}

cfg := yaml.MapSlice{
{Key: "path_prefix", Value: am.PathPrefix},
{Key: "scheme", Value: am.Scheme},
}

@slashpai
Copy link
Contributor Author

I was looking in ScrapeConfig CRD :)

For others some doesn't have validation api level and some are using http/https.
Do we want to update api checks as well?

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.

My bad!

@simonpasquier simonpasquier merged commit 3287e51 into prometheus-operator:main Nov 17, 2023
17 checks passed
@ArthurSens ArthurSens mentioned this pull request Nov 30, 2023
5 tasks
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.

None yet

2 participants