Merge pull request #4069 from MingZhang-YBPS/fix-pull-with-zone

make pull cluster to be able to register with zones
This commit is contained in:
karmada-bot 2023-09-18 14:24:57 +08:00 committed by GitHub
commit 31e58461e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -140,6 +140,7 @@ func run(ctx context.Context, opts *options.Options) error {
ProxyServerAddress: opts.ProxyServerAddress,
ClusterProvider: opts.ClusterProvider,
ClusterRegion: opts.ClusterRegion,
ClusterZones: opts.ClusterZones,
DryRun: false,
ControlPlaneConfig: controlPlaneRestConfig,
ClusterConfig: clusterConfig,

View File

@ -109,6 +109,9 @@ type Options struct {
// ClusterRegion represents the region of the cluster locate in.
ClusterRegion string
// ClusterZones represents the zones of the cluster locate in.
ClusterZones []string
// EnableClusterResourceModeling indicates if enable cluster resource modeling.
// The resource modeling might be used by the scheduler to make scheduling decisions
// in scenario of dynamic replica assignment based on cluster free resources.
@ -189,6 +192,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet, allControllers []string) {
fs.StringVar(&o.MetricsBindAddress, "metrics-bind-address", ":8080", "The TCP address that the controller should bind to for serving prometheus metrics(e.g. 127.0.0.1:8080, :8080). It can be set to \"0\" to disable the metrics serving.")
fs.StringVar(&o.ClusterProvider, "cluster-provider", "", "Provider of the joining cluster. The Karmada scheduler can use this information to spread workloads across providers for higher availability.")
fs.StringVar(&o.ClusterRegion, "cluster-region", "", "The region of the joining cluster. The Karmada scheduler can use this information to spread workloads across regions for higher availability.")
fs.StringSliceVar(&o.ClusterZones, "cluster-zones", []string{}, "The zones of the joining cluster. The Karmada scheduler can use this information to spread workloads across zones for higher availability.")
fs.BoolVar(&o.EnableClusterResourceModeling, "enable-cluster-resource-modeling", true, "Enable means controller would build resource modeling for each cluster by syncing Nodes and Pods resources.\n"+
"The resource modeling might be used by the scheduler to make scheduling decisions in scenario of dynamic replica assignment based on cluster free resources.\n"+
"Disable if it does not fit your cases for better performance.")

View File

@ -169,6 +169,7 @@ func NewCmdRegister(parentCommand string) *cobra.Command {
flags.StringVar(&opts.ClusterNamespace, "cluster-namespace", options.DefaultKarmadaClusterNamespace, "Namespace in the control plane where member cluster secrets are stored.")
flags.StringVar(&opts.ClusterProvider, "cluster-provider", "", "Provider of the joining cluster. The Karmada scheduler can use this information to spread workloads across providers for higher availability.")
flags.StringVar(&opts.ClusterRegion, "cluster-region", "", "The region of the joining cluster. The Karmada scheduler can use this information to spread workloads across regions for higher availability.")
flags.StringSliceVar(&opts.ClusterZones, "cluster-zones", []string{}, "The zones of the joining cluster. The Karmada scheduler can use this information to spread workloads across zones for higher availability.")
flags.BoolVar(&opts.EnableCertRotation, "enable-cert-rotation", false, "Enable means controller would rotate certificate for karmada-agent when the certificate is about to expire.")
flags.StringVar(&opts.CACertPath, "ca-cert-path", CACertPath, "The path to the SSL certificate authority used to secure communications between member cluster and karmada-control-plane.")
flags.StringVar(&opts.BootstrapToken.Token, "token", "", "For token-based discovery, the token used to validate cluster information fetched from the API server.")
@ -207,6 +208,9 @@ type CommandRegisterOption struct {
// ClusterRegion represents the region of the cluster locate in.
ClusterRegion string
// ClusterZones represents the zones of the cluster locate in.
ClusterZones []string
// EnableCertRotation indicates if enable certificate rotation for karmada-agent.
EnableCertRotation bool
@ -668,6 +672,7 @@ func (o *CommandRegisterOption) makeKarmadaAgentDeployment() *appsv1.Deployment
fmt.Sprintf("--cluster-api-endpoint=%s", o.memberClusterEndpoint),
fmt.Sprintf("--cluster-provider=%s", o.ClusterProvider),
fmt.Sprintf("--cluster-region=%s", o.ClusterRegion),
fmt.Sprintf("--cluster-zones=%s", strings.Join(o.ClusterZones, ",")),
fmt.Sprintf("--controllers=%s", strings.Join(controllers, ",")),
"--cluster-status-update-frequency=10s",
"--bind-address=0.0.0.0",