-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
34 lines (30 loc) · 943 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"context"
"fmt"
"flag"
"time"
"github.com/external-secrets/vmes/pkg/configdata"
vmescontroller "github.com/external-secrets/vmes/pkg/controllers"
"github.com/go-co-op/gocron"
)
func main() {
flag.StringVar(&configdata.ConfigLocation, "config-path", "/root/.vmes", "Where yaml files should be placed.")
flag.StringVar(&configdata.PublicKeyFilePath, "public-key-path", "", "Public key file path to use for encryption.")
flag.Parse()
configdata.InitConfig()
fmt.Println("Starting")
recon := vmescontroller.Reconciler{}
ctx := context.Background()
// Reconcile 1 time before scheduler to get refreshInterval
err := recon.Reconcile(ctx)
if err != nil {
fmt.Printf("could not reconcile: %w", err)
}
s := gocron.NewScheduler(time.UTC)
_, err = s.Every(configdata.RefreshInterval.Duration.String()).Do(func() { recon.Reconcile(ctx) })
if err != nil {
fmt.Println(err.Error())
}
s.StartBlocking()
}