Add alerting http proxy option

Signed-off-by: Léopold Jacquot <leopold.jacquot@infomaniak.com>
This commit is contained in:
Léopold Jacquot
2021-04-08 11:58:19 +02:00
parent e6c740d917
commit b82fd5e5a5
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
}