generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
53 lines (45 loc) · 1.51 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2024, 2025, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
package main
import (
"github.com/oracle-cne/ocne/pkg/cluster/driver/none"
"github.com/oracle-cne/ocne/pkg/cluster/driver/olvm"
"github.com/oracle-cne/ocne/pkg/features"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"os"
"github.com/oracle-cne/ocne/cmd/root"
"github.com/oracle-cne/ocne/pkg/cluster/driver"
"github.com/oracle-cne/ocne/pkg/cluster/driver/byo"
"github.com/oracle-cne/ocne/pkg/cluster/driver/capi"
"github.com/oracle-cne/ocne/pkg/cluster/driver/libvirt"
"github.com/oracle-cne/ocne/pkg/util/garbage"
"github.com/spf13/pflag"
)
func registerDrivers() {
driver.RegisterDriver(byo.DriverName, byo.CreateDriver)
driver.RegisterDriver(capi.DriverName, capi.CreateDriver)
if features.OLVM {
driver.RegisterDriver(olvm.DriverName, olvm.CreateDriver)
}
driver.RegisterDriver(libvirt.DriverName, libvirt.CreateDriver)
driver.RegisterDriver(none.DriverName, none.CreateDriver)
}
func main() {
// Allow timestamps for logging
log.SetFormatter(&log.TextFormatter{
FullTimestamp: true,
})
// Allow prefix matching to minimize typing
cobra.EnablePrefixMatching = true
// Register any cluster drivers
registerDrivers()
flags := pflag.NewFlagSet("ocne", pflag.ExitOnError)
pflag.CommandLine = flags
rootCmd := root.NewRootCmd()
if err := rootCmd.Execute(); err != nil {
garbage.Cleanup()
os.Exit(1)
}
garbage.Cleanup()
}