forked from openyurtio/openyurt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve concurrent workers for raven controllers (openyurtio#2089)
- Loading branch information
1 parent
293ef12
commit 0fa908b
Showing
15 changed files
with
322 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright 2023 The OpenYurt Authors. | ||
Licensed under the Apache License, Version 2.0 (the License); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an AS IS BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/openyurtio/openyurt/pkg/yurtmanager/controller/raven/dns/config" | ||
) | ||
|
||
type GatewayDNSControllerOptions struct { | ||
*config.GatewayDNSControllerConfiguration | ||
} | ||
|
||
func NewGatewayDNSControllerOptions() *GatewayDNSControllerOptions { | ||
return &GatewayDNSControllerOptions{ | ||
&config.GatewayDNSControllerConfiguration{ | ||
ConcurrentGatewayDNSWorkers: 1, | ||
}, | ||
} | ||
} | ||
|
||
// AddFlags adds flags related to gateway for yurt-manager to the specified FlagSet. | ||
func (g *GatewayDNSControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||
if g == nil { | ||
return | ||
} | ||
|
||
fs.Int32Var(&g.ConcurrentGatewayDNSWorkers, "concurrent-gateway-dns-workers", g.ConcurrentGatewayDNSWorkers, "The number of gateway objects that are allowed to reconcile concurrently. Larger number = more responsive gateway dns, but more CPU (and network) load") | ||
|
||
} | ||
|
||
// ApplyTo fills up gateway config with options. | ||
func (g *GatewayDNSControllerOptions) ApplyTo(cfg *config.GatewayDNSControllerConfiguration) error { | ||
if g == nil { | ||
return nil | ||
} | ||
|
||
cfg.ConcurrentGatewayDNSWorkers = g.ConcurrentGatewayDNSWorkers | ||
return nil | ||
} | ||
|
||
// Validate checks validation of GatewayControllerOptions. | ||
func (g *GatewayDNSControllerOptions) Validate() []error { | ||
if g == nil { | ||
return nil | ||
} | ||
var errs []error | ||
return errs | ||
} |
64 changes: 64 additions & 0 deletions
64
cmd/yurt-manager/app/options/gatewayinternalsvccontroller.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright 2023 The OpenYurt Authors. | ||
Licensed under the Apache License, Version 2.0 (the License); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an AS IS BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/openyurtio/openyurt/pkg/yurtmanager/controller/raven/gatewayinternalservice/config" | ||
) | ||
|
||
type GatewayInternalSvcControllerOptions struct { | ||
*config.GatewayInternalSvcControllerConfiguration | ||
} | ||
|
||
func NewGatewayInternalSvcControllerOptions() *GatewayInternalSvcControllerOptions { | ||
return &GatewayInternalSvcControllerOptions{ | ||
&config.GatewayInternalSvcControllerConfiguration{ | ||
ConcurrentGatewayInternalSvcWorkers: 1, | ||
}, | ||
} | ||
} | ||
|
||
// AddFlags adds flags related to gateway for yurt-manager to the specified FlagSet. | ||
func (g *GatewayInternalSvcControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||
if g == nil { | ||
return | ||
} | ||
|
||
fs.Int32Var(&g.ConcurrentGatewayInternalSvcWorkers, "concurrent-gateway-internal-svc-workers", g.ConcurrentGatewayInternalSvcWorkers, "The number of gateway objects that are allowed to reconcile concurrently. Larger number = more responsive gateway internal svc, but more CPU (and network) load") | ||
|
||
} | ||
|
||
// ApplyTo fills up gateway config with options. | ||
func (g *GatewayInternalSvcControllerOptions) ApplyTo(cfg *config.GatewayInternalSvcControllerConfiguration) error { | ||
if g == nil { | ||
return nil | ||
} | ||
|
||
cfg.ConcurrentGatewayInternalSvcWorkers = g.ConcurrentGatewayInternalSvcWorkers | ||
return nil | ||
} | ||
|
||
// Validate checks validation of GatewayControllerOptions. | ||
func (g *GatewayInternalSvcControllerOptions) Validate() []error { | ||
if g == nil { | ||
return nil | ||
} | ||
var errs []error | ||
return errs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
cmd/yurt-manager/app/options/gatewaypublicsvccontroller.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright 2023 The OpenYurt Authors. | ||
Licensed under the Apache License, Version 2.0 (the License); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an AS IS BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package options | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/openyurtio/openyurt/pkg/yurtmanager/controller/raven/gatewaypublicservice/config" | ||
) | ||
|
||
type GatewayPublicSvcControllerOptions struct { | ||
*config.GatewayPublicSvcControllerConfiguration | ||
} | ||
|
||
func NewGatewayPublicSvcControllerOptions() *GatewayPublicSvcControllerOptions { | ||
return &GatewayPublicSvcControllerOptions{ | ||
&config.GatewayPublicSvcControllerConfiguration{ | ||
ConcurrentGatewayPublicSvcWorkers: 1, | ||
}, | ||
} | ||
} | ||
|
||
// AddFlags adds flags related to gateway for yurt-manager to the specified FlagSet. | ||
func (g *GatewayPublicSvcControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||
if g == nil { | ||
return | ||
} | ||
|
||
fs.Int32Var(&g.ConcurrentGatewayPublicSvcWorkers, "concurrent-gateway-public-svc-workers", g.ConcurrentGatewayPublicSvcWorkers, "The number of gateway objects that are allowed to reconcile concurrently. Larger number = more responsive gateway public svc, but more CPU (and network) load") | ||
|
||
} | ||
|
||
// ApplyTo fills up gateway config with options. | ||
func (g *GatewayPublicSvcControllerOptions) ApplyTo(cfg *config.GatewayPublicSvcControllerConfiguration) error { | ||
if g == nil { | ||
return nil | ||
} | ||
|
||
cfg.ConcurrentGatewayPublicSvcWorkers = g.ConcurrentGatewayPublicSvcWorkers | ||
return nil | ||
} | ||
|
||
// Validate checks validation of GatewayControllerOptions. | ||
func (g *GatewayPublicSvcControllerOptions) Validate() []error { | ||
if g == nil { | ||
return nil | ||
} | ||
var errs []error | ||
return errs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Access has been restricted
You have triggered a rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.