Skip to content

Commit

Permalink
title: virtualcluster join controller could delete useless node when …
Browse files Browse the repository at this point in the history
…update virtualcluster

Signed-off-by: dongweiguo <[email protected]>
  • Loading branch information
GreatLazyMan committed Apr 2, 2024
1 parent 4488663 commit 7e35c9d
Show file tree
Hide file tree
Showing 4 changed files with 2,727 additions and 73 deletions.
8 changes: 5 additions & 3 deletions cmd/clustertree-operator/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
)

type Options struct {
LeaderElection componentbaseconfig.LeaderElectionConfiguration
KubernetesOptions KubernetesOptions
LeaderElection componentbaseconfig.LeaderElectionConfiguration
KubernetesOptions KubernetesOptions
AllowNodeOwnbyMulticluster bool
}

type KubernetesOptions struct {
Expand All @@ -37,10 +38,11 @@ func (o *Options) AddFlags(flags *pflag.FlagSet) {
}

flags.BoolVar(&o.LeaderElection.LeaderElect, "leader-elect", true, "Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability.")
flags.StringVar(&o.LeaderElection.ResourceName, "leader-elect-resource-name", "network-manager", "The name of resource object that is used for locking during leader election.")
flags.StringVar(&o.LeaderElection.ResourceName, "leader-elect-resource-name", "clustertree-operator", "The name of resource object that is used for locking during leader election.")
flags.StringVar(&o.LeaderElection.ResourceNamespace, "leader-elect-resource-namespace", utils.DefaultNamespace, "The namespace of resource object that is used for locking during leader election.")
flags.Float32Var(&o.KubernetesOptions.QPS, "kube-qps", 40.0, "QPS to use while talking with kube-apiserver.")
flags.IntVar(&o.KubernetesOptions.Burst, "kube-burst", 60, "Burst to use while talking with kube-apiserver.")
flags.StringVar(&o.KubernetesOptions.KubeConfig, "kubeconfig", "", "Path for kubernetes kubeconfig file, if left blank, will use in cluster way.")
flags.StringVar(&o.KubernetesOptions.Master, "master", "", "Used to generate kubeconfig for downloading, if not specified, will use host in kubeconfig.")
flags.BoolVar(&o.AllowNodeOwnbyMulticluster, "multiowner", false, "Allow node own by multicluster or not.")
}
7 changes: 4 additions & 3 deletions cmd/clustertree-operator/app/tree_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ func run(ctx context.Context, opts *options.Options) error {
}

VirtualClusterJoinController := controller.VirtualClusterJoinController{
Client: mgr.GetClient(),
EventRecorder: mgr.GetEventRecorderFor(constants.JoinControllerName),
KubeconfigPath: opts.KubernetesOptions.KubeConfig,
Client: mgr.GetClient(),
EventRecorder: mgr.GetEventRecorderFor(constants.JoinControllerName),
KubeconfigPath: opts.KubernetesOptions.KubeConfig,
AllowNodeOwnbyMulticluster: opts.AllowNodeOwnbyMulticluster,
}
if err = VirtualClusterJoinController.SetupWithManager(mgr); err != nil {
return fmt.Errorf("error starting %s: %v", constants.JoinControllerName, err)
Expand Down
Loading

0 comments on commit 7e35c9d

Please sign in to comment.