-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Webex Feature/API #5305
Webex Feature/API #5305
Conversation
Signed-off-by: Frank Kloeker <f.kloeker@telekom.de>
the bundle version needs to bump up |
Great! @eumel8 you can generate the bundle by using I see your tests are not passing, |
Thanks for starting this! You'd need to update https://github.com/prometheus-operator/prometheus-operator/blob/main/pkg/apis/monitoring/v1beta1/conversion_from.go and https://github.com/prometheus-operator/prometheus-operator/blob/main/pkg/apis/monitoring/v1beta1/conversion_to.go to convert between v1alpha1 and v1beta1 types. |
// WebexConfig configures notification via Cisco Webex | ||
// See https://prometheus.io/docs/alerting/latest/configuration/#webex_config | ||
type WebexConfig struct { | ||
SendResolved *bool `json:"sendResolved,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SendResolved *bool `json:"sendResolved,omitempty"` | |
// Whether to notify about resolved alerts. | |
SendResolved *bool `json:"sendResolved,omitempty"` |
// See https://prometheus.io/docs/alerting/latest/configuration/#webex_config | ||
type WebexConfig struct { | ||
SendResolved *bool `json:"sendResolved,omitempty"` | ||
APIURL string `json:"apiURL,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APIURL string `json:"apiURL,omitempty"` | |
// The Webex Teams API URL if different from the default API URL. | |
APIURL string `json:"apiURL,omitempty"` |
APIURL string `json:"apiURL,omitempty"` | ||
RoomID string `json:"roomID,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` | |
// HTTP client configuration. | |
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` |
Signed-off-by: Frank Kloeker <f.kloeker@telekom.de>
Signed-off-by: Frank Kloeker <f.kloeker@telekom.de>
thx for starting review, @xiu @simonpasquier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments for each field? Next step is to wire the webex integration in
prometheus-operator/pkg/alertmanager/amcfg.go
Line 464 in 6be89b4
func (cb *configBuilder) convertReceiver(ctx context.Context, in *monitoringv1alpha1.Receiver, crKey types.NamespacedName) (*receiver, error) { |
Signed-off-by: Frank Kloeker <f.kloeker@telekom.de>
just wondering,
|
This is not the issue as I see it. Check https://github.com/prometheus-operator/prometheus-operator/actions/runs/4088515306/jobs/7050273000, the step is checking whether all generated content has been committed. It thus runs Can you run |
Signed-off-by: Frank Kloeker <f.kloeker@telekom.de>
@xiu This was the error on my local Ubuntu WSL. I couldn't found out the cause and made make generate on another machine. Maybe there are some hints for build requirements beside make and Go. |
Oh, I don't have a Windows machine to try that out unfortunately. Glad you made it work! |
@simonpasquier I'm not sure, anything else to change here? |
You need to update the convertReceiver() method to convert the Webex configuration from the CRD to the native Alertmanager configuration. You can take a look at #4726 which did the same thing but for the Telegram integration. Does it make sense? |
any time when it will get unblocked? |
@fctb It's progressing slowly. I'm a bit overwhelmed with the feature. Any help is appreciated, hopefully it will be over soon. |
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@eumel8 I've added a few commits on top of your PR to address my comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change necessary for this PR? Otherwise I'd prefer to revert :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted the change - if the E2E suite passes, it is indeed not necessary. I'd only changed it, as it didn't work when I ran the E2E tests locally and after debugging I'd found out the issue were the missing fields in the AM Config 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests passed, so thanks for reviewing this change as well. Reverted as requested.
test/e2e/scrapeconfig_test.go
Outdated
@@ -216,7 +216,7 @@ func testPromOperatorStartsWithoutScrapeConfigCRD(t *testing.T) { | |||
|
|||
restarts, err := framework.GetPodRestartCount(context.Background(), ns, pl.Items[0].GetName()) | |||
require.NoError(t, err) | |||
require.Lenf(t, restarts, 1, "expected to get 1 container but got %d", len(restarts)) | |||
require.Emptyf(t, restarts, "expected to get 1 container but got %d", len(restarts)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was failing on my machine with the message "expected to get 1 container but got 1". On line 213 one Pod is explicitly expected. The GetPodRestartCount will therefore always return a map with at least one container, which should have 0 restarts. The restarts
map has therefore a length of at least 1.
Emptyf checks whether the map is empty, which it shouldn't. The error msg is even more cryptic, as it refers to the length of the map, which should be one according to the message. But here we're checking whether the map's nil / empty?
I can't get my head around as to how this tests works 😄 I just wanted to explain, why I made this change and why I didn't consider it unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good! One last nit...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, I approved and forgot to merge this one after 3 weeks... sorry! 😅
Approving again and I'll let simon take another look if he wants to :)
I'm putting a reminder to merge it this week if there is no more change requests
Signed-off-by: Frank Kloeker f.kloeker@telekom.de
Description
Prometheus Alertmanager brings the functionality of Webex Notification. Start of Operator implementation was here
This is the part of API/CRD extension
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.)ref:#5295
Changelog entry