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

Add ttl obj to alertmanagercfgs resource #6515

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

afzal442
Copy link

@afzal442 afzal442 commented Apr 15, 2024

Description

Added ttl object to alertmanagerConfig resource after time to live introduction on pushoverConfig

Closes: #6360

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

Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.

Changelog entry

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

Added `ttl` object to alertmanagercfgs resource

@afzal442 afzal442 requested a review from a team as a code owner April 15, 2024 18:29
@afzal442 afzal442 marked this pull request as draft April 15, 2024 18:37
@afzal442 afzal442 marked this pull request as ready for review April 16, 2024 06:14
@afzal442
Copy link
Author

afzal442 commented Apr 16, 2024

hello @onedr0p do wanna review here till now? I guess validation is still left. thanks

cc @slashpai

@onedr0p
Copy link

onedr0p commented Apr 16, 2024

Change looks good here but I'm not a member of this org, so probably better to leave the review up to someone who is.

@afzal442
Copy link
Author

@slashpai any review will be great.

afzal442 and others added 3 commits May 9, 2024 13:11
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.

You also need to push the TTL value to the generated config in here

func (cb *configBuilder) convertPushoverConfig(ctx context.Context, in monitoringv1alpha1.PushoverConfig, crKey types.NamespacedName) (*pushoverConfig, error) {

pkg/alertmanager/types.go Outdated Show resolved Hide resolved
pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go Outdated Show resolved Hide resolved
@@ -11,6 +11,11 @@ require (
sigs.k8s.io/controller-runtime v0.17.2
)

require (
github.com/prometheus/client_model v0.6.0 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

we shouldn't depend on prometheus/client_model.

@@ -808,6 +809,9 @@ type PushoverConfig struct {
// A title for supplementary URL, otherwise just the URL is shown
// +optional
URLTitle string `json:"urlTitle,omitempty"`
// The time to live definition for the alert notification
// +optional
TTL *model.Duration `json:"ttl,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

you want v1.Duration (though I see that the pushover duration is a custom type in Alertmanager code, not sure why).

Copy link
Author

Choose a reason for hiding this comment

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

I see that the pushover duration is a custom type in Alertmanager code

sorry, where? any pointer

Copy link
Contributor

Choose a reason for hiding this comment

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

I was referring to https://github.com/prometheus/alertmanager/blob/91a94f00f987048fa4f42856165d49370a3af568/config/notifiers.go#L705

But I notice that we're not 100% compliant with the other Pushover duration fields. We can fix them later but for ttl it would be better to use the existing v1.Duration type.

pkg/alertmanager/types.go Show resolved Hide resolved
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.

Add ttl to alertmanagerconfigs resource
4 participants