@@ -21,8 +21,11 @@ import (
2121 "flag"
2222 "os"
2323 "runtime/debug"
24+ "syscall"
2425 "time"
2526
27+ "github.com/argoproj-labs/gitops-promoter/internal/webhookreceiver"
28+
2629 "go.uber.org/zap/zapcore"
2730
2831 "github.com/argoproj-labs/gitops-promoter/internal/utils"
@@ -74,13 +77,13 @@ func main() {
7477 "If set the metrics endpoint is served securely" )
7578 flag .BoolVar (& enableHTTP2 , "enable-http2" , false ,
7679 "If set, HTTP/2 will be enabled for the metrics and webhook servers" )
77- flag .StringVar (& promotionStrategyRequeue , "promotion-strategy-requeue-duration" , "60s " ,
80+ flag .StringVar (& promotionStrategyRequeue , "promotion-strategy-requeue-duration" , "300s " ,
7881 "How frequently to requeue promotion strategy resources for auto reconciliation" )
79- flag .StringVar (& changeTransferPolicyRequeue , "change-transfer-policy-requeue-duration" , "60s " ,
82+ flag .StringVar (& changeTransferPolicyRequeue , "change-transfer-policy-requeue-duration" , "300s " ,
8083 "How frequently to requeue proposed commit resources for auto reconciliation" )
8184 opts := zap.Options {
8285 Development : true ,
83- TimeEncoder : zapcore .ISO8601TimeEncoder ,
86+ TimeEncoder : zapcore .RFC3339NanoTimeEncoder ,
8487 }
8588 opts .BindFlags (flag .CommandLine )
8689 flag .Parse ()
@@ -143,10 +146,6 @@ func main() {
143146 panic ("unable to start manager" )
144147 }
145148
146- // TODO: Create secret informer, and possibly ScmProvider Informer to pass into controllers
147- // kubeClient, err := kubernetes.NewForConfig(mgr.GetConfig())
148- // informerFactory := informers.NewSharedInformerFactory(kubeClient, 10*time.Minute)
149-
150149 pathLookup := utils .NewPathLookup ()
151150
152151 if err = (& controller.PullRequestReconciler {
@@ -225,9 +224,17 @@ func main() {
225224
226225 processSignals := ctrl .SetupSignalHandler ()
227226
228- // setupLog.Info("starting informer factory")
229- // informerFactory.Start(processSignals.Done())
230- // informerFactory.WaitForCacheSync(processSignals.Done())
227+ whr := webhookreceiver .NewWebhookReceiver (mgr )
228+ go func () {
229+ err = whr .Start (processSignals , ":3333" )
230+ if err != nil {
231+ setupLog .Error (err , "unable to start webhook receiver" )
232+ err = syscall .Kill (syscall .Getpid (), syscall .SIGTERM )
233+ if err != nil {
234+ setupLog .Error (err , "unable to kill process" )
235+ }
236+ }
237+ }()
231238
232239 setupLog .Info ("starting manager" )
233240 if err := mgr .Start (processSignals ); err != nil {
0 commit comments