-
Notifications
You must be signed in to change notification settings - Fork 27
/
config.go
56 lines (41 loc) · 1.37 KB
/
config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package config
import (
"fmt"
"time"
"github.com/bpineau/katafygio/pkg/client"
"github.com/sirupsen/logrus"
"k8s.io/client-go/rest"
)
// KfConfig holds the configuration options passed at launch time (and the rest client)
type KfConfig struct {
// When DryRun is true, we don't write to disk and we don't commit/push
DryRun bool
// When DumpMode is true, we just dump everything once and exit
DumpMode bool
// Logger should be used to send all logs
Logger *logrus.Logger
// Client represents a connection to a Kubernetes cluster
Client *rest.Config
// GitURL is the address of a remote git repository
GitURL string
// LocalDir is the local path where we'll serialize cluster objets
LocalDir string
// Filter holds a facultative Kubernetes selector
Filter string
// ExcludeKind holds a list of resources types we won't dump
ExcludeKind []string
// ExcludeObject holds a list of objects we won't dump
ExcludeObject []string
// HealthPort is the facultative healthcheck port
HealthPort int
// ResyncIntv define the duration between full resync. Set to 0 to disable resyncs.
ResyncIntv time.Duration
}
// Init initialize the config
func (c *KfConfig) Init(apiserver string, kubeconfig string) (err error) {
c.Client, err = client.NewRestConfig(apiserver, kubeconfig)
if err != nil {
return fmt.Errorf("Failed init Kubernetes clientset: %+v", err)
}
return nil
}