Merge pull request #3214 from yuswift/feature/support_configurable_cluster_resync_perioud

Configurable cluster resync perioud
This commit is contained in:
KubeSphere CI Bot
2021-01-25 14:04:42 +08:00
committed by GitHub
4 changed files with 34 additions and 22 deletions

View File

@@ -16,7 +16,13 @@ limitations under the License.
package multicluster
import "github.com/spf13/pflag"
import (
"time"
"github.com/spf13/pflag"
)
const DefaultResyncPeriod = time.Duration(120) * time.Second
type Options struct {
// Enable
@@ -36,16 +42,20 @@ type Options struct {
// AgentImage is the image used when generating deployment for all cluster agents.
AgentImage string `json:"agentImage,omitempty"`
// ClusterControllerResyncSecond is the resync period used by cluster controller.
ClusterControllerResyncSecond time.Duration `json:"clusterControllerResyncSecond,omitempty" yaml:"clusterControllerResyncSecond"`
}
// NewOptions() returns a default nil options
func NewOptions() *Options {
return &Options{
Enable: false,
EnableFederation: false,
ProxyPublishAddress: "",
ProxyPublishService: "",
AgentImage: "kubesphere/tower:v1.0",
Enable: false,
EnableFederation: false,
ProxyPublishAddress: "",
ProxyPublishService: "",
AgentImage: "kubesphere/tower:v1.0",
ClusterControllerResyncSecond: DefaultResyncPeriod,
}
}
@@ -67,4 +77,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet, s *Options) {
fs.StringVar(&o.AgentImage, "agent-image", s.AgentImage, ""+
"This field is used when generating deployment yaml for agent.")
fs.DurationVar(&o.ClusterControllerResyncSecond, "cluster-controller-resync-second", s.ClusterControllerResyncSecond,
"Cluster controller resync second to sync cluster resource.")
}