/
main.go
30 lines (25 loc) · 907 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
package main
import (
"context"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"github.com/kyma-project/kyma/components/nats-operator/logger"
"github.com/kyma-project/kyma/components/nats-operator/options"
"github.com/kyma-project/kyma/components/nats-operator/pkg/client/natscluster"
"github.com/kyma-project/kyma/components/nats-operator/pkg/doctor"
)
func main() {
// setup
log := logger.New()
ctx := context.Background()
opts := options.New().Parse()
k8sConfig := config.GetConfigOrDie()
k8sClient := kubernetes.NewForConfigOrDie(k8sConfig)
dynamicClient := dynamic.NewForConfigOrDie(k8sConfig)
natsClient := natscluster.NewClient(dynamicClient)
// start
if err := doctor.New(k8sClient, natsClient, opts.Interval, log).Start(ctx); err != nil {
log.Fatalf("nats-operator health-check failed with error: %v", err)
}
}