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

Alertmanager ttl #6371

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

Conversation

aerosouund
Copy link

Description

Add TTL field to alertmanager config
solves: #6360

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

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

Changelog entry

add ttl to alertmanagerConfig

Signed-off-by: aerosouund <aerosound161@gmail.com>
Signed-off-by: aerosouund <aerosound161@gmail.com>
Signed-off-by: aerosouund <aerosound161@gmail.com>
@aerosouund aerosouund requested a review from a team as a code owner March 6, 2024 12:35
@yp969803
Copy link
Contributor

yp969803 commented Mar 6, 2024

@aerosouund you have added the field that is good,
Some reviews:

  • Run "go fmt -w ." after the completion of code
  • Run "make generate"
  • Merge all the commit into one commit which should follow a certain pattern you can see previous commits

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Thanks for starting the PR!

The changes made to the API are almost there, we also want to incorporate the changes you've made to the API to the alertmanager packages, i.e. we want to write this configuration in Alertmanager's config files if it is set.

@slashpai shared some directions here: #6360 (comment)

go 1.22
go 1.22.0
Copy link
Member

Choose a reason for hiding this comment

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

Was this change intentional?

@@ -29,6 +29,7 @@ import (
// https://github.com/prometheus/alertmanager/issues/1985
type alertmanagerConfig struct {
Global *globalConfig `yaml:"global,omitempty" json:"global,omitempty"`
TTL duration `yaml:"ttl,omitempty" json:"ttl,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

We have a linting problem here, you can fix it by running make format :)

@@ -783,6 +784,9 @@ type PushoverConfig struct {
// Notification title.
// +optional
Title string `json:"title,omitempty"`
// time to live for the alert notification
// +optional
TTL time.Duration `json:"ttl,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TTL time.Duration `json:"ttl,omitempty"`
TTL *Duration `json:"ttl,omitempty"`

We have a custom Duration type, which has some useful validations on the API level. Could we use this one instead?

Also, we follow k8s API conventions as much as possible, which means we want to use pointers for optional fields.

@github-actions github-actions bot added the stale label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants