-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow CPLB to work with externalAddress #4452
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ type keepalivedSuite struct { | |
|
||
const haControllerConfig = ` | ||
spec: | ||
api: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we test both setups here? One with externalAddress and one with NLLB? |
||
externalAddress: %s | ||
network: | ||
controlPlaneLoadBalancing: | ||
enabled: true | ||
|
@@ -43,9 +45,6 @@ spec: | |
authPass: "123456" | ||
virtualServers: | ||
- ipAddress: %s | ||
nodeLocalLoadBalancing: | ||
enabled: true | ||
type: EnvoyProxy | ||
` | ||
|
||
// SetupTest prepares the controller and filesystem, getting it into a consistent | ||
|
@@ -57,10 +56,10 @@ func (s *keepalivedSuite) TestK0sGetsUp() { | |
|
||
for idx := 0; idx < s.BootlooseSuite.ControllerCount; idx++ { | ||
s.Require().NoError(s.WaitForSSH(s.ControllerNode(idx), 2*time.Minute, 1*time.Second)) | ||
s.PutFile(s.ControllerNode(idx), "/tmp/k0s.yaml", fmt.Sprintf(haControllerConfig, lb, lb)) | ||
s.PutFile(s.ControllerNode(idx), "/tmp/k0s.yaml", fmt.Sprintf(haControllerConfig, lb, lb, lb)) | ||
|
||
// Note that the token is intentionally empty for the first controller | ||
s.Require().NoError(s.InitController(idx, "--config=/tmp/k0s.yaml", "--disable-components=metrics-server", joinToken)) | ||
s.Require().NoError(s.InitController(idx, "--config=/tmp/k0s.yaml", "--disable-components=metrics-server,endpoint-reconciler", joinToken)) | ||
s.Require().NoError(s.WaitJoinAPI(s.ControllerNode(idx))) | ||
|
||
// With the primary controller running, create the join token for subsequent controllers. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,20 +45,21 @@ import ( | |
|
||
// Keepalived is the controller for the keepalived process in the control plane load balancing | ||
type Keepalived struct { | ||
K0sVars *config.CfgVars | ||
Config *k0sAPI.KeepalivedSpec | ||
DetailedLogging bool | ||
LogConfig bool | ||
APIPort int | ||
KubeConfigPath string | ||
keepalivedConfig *keepalivedConfig | ||
uid int | ||
supervisor *supervisor.Supervisor | ||
log *logrus.Entry | ||
configFilePath string | ||
reconciler *CPLBReconciler | ||
updateCh chan struct{} | ||
reconcilerDone chan struct{} | ||
K0sVars *config.CfgVars | ||
Config *k0sAPI.KeepalivedSpec | ||
DetailedLogging bool | ||
LogConfig bool | ||
APIPort int | ||
KubeConfigPath string | ||
HasEndpointReconciler bool | ||
keepalivedConfig *keepalivedConfig | ||
uid int | ||
supervisor *supervisor.Supervisor | ||
log *logrus.Entry | ||
configFilePath string | ||
reconciler *CPLBReconciler | ||
updateCh chan struct{} | ||
reconcilerDone chan struct{} | ||
} | ||
|
||
// Init extracts the needed binaries and creates the directories | ||
|
@@ -92,6 +93,9 @@ func (k *Keepalived) Start(_ context.Context) error { | |
} | ||
|
||
if len(k.Config.VirtualServers) > 0 { | ||
if k.HasEndpointReconciler { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about moving that check out the component into the controller command? Otherwise the |
||
return errors.New("virtual servers are not supported with the endpoint-reconciler enabled.") | ||
} | ||
k.log.Info("Starting CPLB reconciler") | ||
updateCh := make(chan struct{}, 1) | ||
k.reconciler = NewCPLBReconciler(k.KubeConfigPath, updateCh) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is also used at line 436/438 for the endpoint reconciler component itself. Would be cool to reuse this boolean there as well. And it could deserve a less ambiguous name: Basically it swaps endpoint reconcilers. What about naming this
preferExternalAddressEndpointReconciler
,preferK0sEndpointReconciler
or sth. like that?