Skip to content

Feat: Add API URL validation for OpsGenie receiver in CR#8206

Merged
simonpasquier merged 6 commits intoprometheus-operator:mainfrom
nutmos:feat/add-url-validation-opsgenie-cr
Dec 24, 2025
Merged

Feat: Add API URL validation for OpsGenie receiver in CR#8206
simonpasquier merged 6 commits intoprometheus-operator:mainfrom
nutmos:feat/add-url-validation-opsgenie-cr

Conversation

@nutmos
Copy link
Contributor

@nutmos nutmos commented Dec 23, 2025

Description

This PR adds the validation to OpsGenie APIURL config by changing type in CR from string to URL.

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.)

Verification

Unit Testing

Changelog entry

- Add API URL validation for Alertmanager OpsGenie receiver custom resource

@nutmos nutmos requested a review from a team as a code owner December 23, 2025 14:00
@nutmos nutmos marked this pull request as draft December 23, 2025 14:01
@nutmos nutmos marked this pull request as ready for review December 24, 2025 01:14
if _, err := validation.ValidateURL(config.APIURL); err != nil {
return fmt.Errorf("invalid 'apiURL': %w", err)

if config.APIURL != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) a bit shorter

Suggested change
if config.APIURL != nil {
if ptr.Deref(config.APIURL, "") != "" {

if _, err := validation.ValidateURL(config.APIURL); err != nil {
return fmt.Errorf("invalid 'apiURL': %w", err)

if config.APIURL != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

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.

thanks!

@simonpasquier simonpasquier enabled auto-merge (squash) December 24, 2025 12:37
@simonpasquier simonpasquier merged commit 1165148 into prometheus-operator:main Dec 24, 2025
18 of 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.

2 participants