Skip to content

Commit

Permalink
Move CPLB into its own package
Browse files Browse the repository at this point in the history
Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
  • Loading branch information
juanluisvaladas committed Nov 20, 2024
1 parent bb646e2 commit c01b136
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions cmd/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/k0sproject/k0s/pkg/certificate"
"github.com/k0sproject/k0s/pkg/component/controller"
"github.com/k0sproject/k0s/pkg/component/controller/clusterconfig"
"github.com/k0sproject/k0s/pkg/component/controller/cplb"
"github.com/k0sproject/k0s/pkg/component/controller/leaderelector"
"github.com/k0sproject/k0s/pkg/component/controller/workerconfig"
"github.com/k0sproject/k0s/pkg/component/manager"
Expand Down Expand Up @@ -237,14 +238,14 @@ func (c *command) start(ctx context.Context) error {
// Assume a single active controller during startup
numActiveControllers := value.NewLatest[uint](1)

if cplb := nodeConfig.Spec.Network.ControlPlaneLoadBalancing; cplb != nil && cplb.Enabled {
if cplbCfg := nodeConfig.Spec.Network.ControlPlaneLoadBalancing; cplbCfg != nil && cplbCfg.Enabled {
if c.SingleNode {
return errors.New("control plane load balancing cannot be used in a single-node cluster")
}

nodeComponents.Add(ctx, &controller.Keepalived{
nodeComponents.Add(ctx, &cplb.Keepalived{
K0sVars: c.K0sVars,
Config: cplb.Keepalived,
Config: cplbCfg.Keepalived,
DetailedLogging: c.Debug,
LogConfig: c.Debug,
KubeConfigPath: c.K0sVars.AdminKubeConfigPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controller
package cplb

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controller
package cplb

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controller
package cplb

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package controller
package cplb

import (
"testing"
Expand Down

0 comments on commit c01b136

Please sign in to comment.