feat: trigger webhook on reload

Signed-off-by: Utibeabasi Umanah <utibeabasiumanah6@gmail.com>
This commit is contained in:
Utibeabasi Umanah
2023-09-19 21:51:42 +01:00
parent 8ac634012c
commit 6dc37baf87
6 changed files with 50 additions and 8 deletions
+5
View File
@@ -3,6 +3,7 @@ package handler
import (
"github.com/sirupsen/logrus"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/options"
"github.com/stakater/Reloader/internal/pkg/util"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
@@ -23,6 +24,10 @@ func (r ResourceUpdatedHandler) Handle() error {
} else {
config, oldSHAData := r.GetConfig()
if config.SHAValue != oldSHAData {
// Send a webhook if update
if options.WebhookUrl != "" {
return sendUpgradeWebhook(config, options.WebhookUrl)
}
// process resource based on its type
return doRollingUpgrade(config, r.Collectors, r.Recorder)
}