vpcagent: resolve ovn db address at args validation time

Until we find a reliable way to get k8s svc dns name
This commit is contained in:
Yousong Zhou
2020-02-26 19:55:57 +08:00
parent d6dca0d846
commit 7506f3f1ed

View File

@@ -19,6 +19,7 @@ import (
"yunion.io/x/onecloud/pkg/apis/compute"
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
"yunion.io/x/onecloud/pkg/util/ovsutils"
)
const (
@@ -27,6 +28,7 @@ const (
const (
ErrInvalidVpcProvider = errors.Error("invalid vpc provider")
ErrInvalidOvnDatabase = errors.Error("invalid ovn database")
)
type VpcAgentOptions struct {
@@ -64,5 +66,11 @@ func (opts *Options) ValidateThenInit() error {
if opts.OvnWorkerCheckInterval <= 60 {
opts.OvnWorkerCheckInterval = 60
}
if db, err := ovsutils.NormalizeDbHost(opts.OvnNorthDatabase); err != nil {
return err
} else {
opts.OvnNorthDatabase = db
}
return nil
}