forked from eksctl-io/eksctl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitops.go
More file actions
31 lines (24 loc) · 913 Bytes
/
Copy pathgitops.go
File metadata and controls
31 lines (24 loc) · 913 Bytes
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
package gitops
import (
"time"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
kubeclient "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"github.com/weaveworks/eksctl/pkg/actions/flux"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
)
// DefaultPodReadyTimeout is the time it will wait for Flux and Helm Operator to become ready
const DefaultPodReadyTimeout = 5 * time.Minute
type FluxInstaller interface {
Run() error
}
// Setup sets up gitops in a repository for a cluster.
func Setup(kubeconfigPath string, k8sRestConfig *rest.Config, k8sClientSet kubeclient.Interface, cfg *api.ClusterConfig, timeout time.Duration) error {
installer, err := flux.New(k8sClientSet, cfg.GitOps)
logger.Info("gitops configuration detected, setting installer to Flux v2")
if err != nil {
return errors.Wrapf(err, "could not initialise Flux installer")
}
return installer.Run()
}