Merge pull request #872 from L3o-pold/feature/add-alerting-http-proxy

Add alerting http proxy option
This commit is contained in:
Stefan Prodan
2021-04-28 14:59:37 +03:00
committed by GitHub
22 changed files with 109 additions and 26 deletions
+5 -1
View File
@@ -149,9 +149,13 @@ func (c *Controller) alert(canary *flaggerv1.Canary, message string, metadata bo
if provider.Spec.Channel != "" {
channel = provider.Spec.Channel
}
proxy := ""
if provider.Spec.Proxy != "" {
proxy = provider.Spec.Proxy
}
// create notifier based on provider type
f := notifier.NewFactory(url, username, channel)
f := notifier.NewFactory(url, proxy, username, channel)
n, err := f.Notifier(provider.Spec.Type)
if err != nil {
c.logger.With("canary", fmt.Sprintf("%s.%s", canary.Name, canary.Namespace)).
+4 -1
View File
@@ -61,7 +61,10 @@ func callWebhook(webhook string, payload interface{}, timeout string) error {
ctx, cancel := context.WithTimeout(req.Context(), t)
defer cancel()
r, err := http.DefaultClient.Do(req.WithContext(ctx))
httpClient := http.DefaultClient
httpClient.Transport = http.DefaultTransport
r, err := httpClient.Do(req.WithContext(ctx))
if err != nil {
return err
}