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

feat: adding alertmanager msteams support #6002

Conversation

nicolastakashi
Copy link
Contributor

@nicolastakashi nicolastakashi commented Oct 12, 2023

Description

Adding support for Microsoft Teams receiver, since the pr prometheus/alertmanager#3324 from the upstream project Alertmanager has been merged already. while there's no release for over half one year. and fix #5766.

Co-Authored-By: @ksdpmx

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.

feat: add support for MSTeams receiver

Copy link
Contributor

@slashpai slashpai left a comment

Choose a reason for hiding this comment

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

just a nit, lgtm otherwise :)

pkg/alertmanager/validation/v1alpha1/validation.go Outdated Show resolved Hide resolved
pkg/alertmanager/validation/v1beta1/validation.go Outdated Show resolved Hide resolved
@nicolastakashi nicolastakashi force-pushed the chore/adding-msteams-support branch 2 times, most recently from cfc0be3 to 0da8904 Compare October 17, 2023 07:38
@pixiono
Copy link

pixiono commented Oct 17, 2023

We ran into the same issue today and would like to use the msteams integration.

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.

This looks good in general! And sorry for the delay.

pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go Outdated Show resolved Hide resolved
pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go Outdated Show resolved Hide resolved
pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

same remarks than for v1alpha1

pkg/alertmanager/types.go Outdated Show resolved Hide resolved
@nicolastakashi nicolastakashi force-pushed the chore/adding-msteams-support branch 2 times, most recently from 5f58141 to d2ddab0 Compare October 17, 2023 20:20
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.

One small nit besides the formatting issues

thanks for continuing this!

pkg/alertmanager/amcfg.go Outdated Show resolved Hide resolved
nicolastakashi and others added 7 commits October 21, 2023 11:53
Signed-off-by: Nicolas Takashi <nicolas.tcs@hotmail.com>
Co-Authored-By: ksdpmx
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
@nicolastakashi nicolastakashi force-pushed the chore/adding-msteams-support branch 2 times, most recently from c82d5ae to b33a736 Compare October 21, 2023 10:54
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Copy link

@rgarcia89 rgarcia89 left a comment

Choose a reason for hiding this comment

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

lgtm

@ArthurSens ArthurSens merged commit a10b739 into prometheus-operator:main Oct 23, 2023
17 checks passed
@nicolastakashi nicolastakashi deleted the chore/adding-msteams-support branch October 23, 2023 12:51
@rgarcia89
Copy link

I think I just found some further mistakes which I did not notice during the review...

https://github.com/prometheus-operator/prometheus-operator/blob/a10b739fb3f7a56165ba8d4e1bfb57168ddb78cd/pkg/alertmanager/amcfg.go#L642C1-L652C3
https://github.com/prometheus-operator/prometheus-operator/blob/main/pkg/alertmanager/amcfg.go#L680

MSTeamsConfigs: []monitoringv1alpha1.MSTeamsConfig{

The receiver is defined as msteamsConfigs. Not msTeamsConfigs.

@ArthurSens
Copy link
Member

When encoding go structs to yaml/json, Go uses the structs tags to write down yaml strings

The tag is correct :) msteamsConfigs

MSTeamsConfigs []MSTeamsConfig `json:"msteamsConfigs,omitempty"`

This is also what the golden file is showing us
https://github.com/prometheus-operator/prometheus-operator/blob/a10b739fb3f7a56165ba8d4e1bfb57168ddb78cd/pkg/alertmanager/testdata/CR_with_MSTeams_Receiver.golden

Looking at alertmanager configuration docs, this is also what it is expected

@kj187
Copy link

kj187 commented Oct 31, 2023

Nice job guys! Do you know when we can expect a new prometheus-operator tag to use it?

@simonpasquier
Copy link
Contributor

@kj187 soon, I'm working on it :)

adinhodovic pushed a commit to adinhodovic/prometheus-operator that referenced this pull request Nov 13, 2023
* feat: adding alertmanager msteams support

Signed-off-by: Nicolas Takashi <nicolas.tcs@hotmail.com>
Co-Authored-By: ksdpmx
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 msteams configuration to Alertmanager Config CRD
7 participants