added loadbalancer

This commit is contained in:
ston1th 2021-04-10 01:48:50 +02:00
commit bd94056453
9 changed files with 371 additions and 113 deletions

View file

@ -31,6 +31,10 @@ func init() {
_ = clientgoscheme.AddToScheme(scheme)
}
type config struct {
PVE pve.Config `json:"pve"`
}
func main() {
rand.Seed(time.Now().UnixNano())
klog.InitFlags(nil)
@ -85,17 +89,17 @@ func main() {
}
var opts []pve.ClientOption
config, err := os.Open(cloudConfig)
cr, err := os.Open(cloudConfig)
if err == nil {
buf, _ := ioutil.ReadAll(config)
buf, _ := ioutil.ReadAll(cr)
if len(buf) != 0 {
var cfg pve.Config
var cfg config
err = json.Unmarshal(buf, &cfg)
if err != nil {
setupLog.Error(err, "failed to read config file")
os.Exit(1)
}
opts, err = pve.ClientOptionsFromConfig(cfg)
opts, err = pve.ClientOptionsFromConfig(cfg.PVE)
if err != nil {
setupLog.Error(err, "failed to create client options from file")
os.Exit(1)