Skip to content

Commit

Permalink
Use CNI with capital letters
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Buil <[email protected]>
  • Loading branch information
manuelbuil committed Jan 23, 2024
1 parent c6fee0e commit f827656
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions pkg/pebinaryexecutor/pebinary.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type PEBinaryConfig struct {
DisableETCD bool
IsServer bool
CNIName string
CniPlugin win.CniPlugin
CNIPlugin win.CNIPlugin
}

type CloudProviderConfig struct {
Expand Down Expand Up @@ -104,15 +104,15 @@ func (p *PEBinaryConfig) Bootstrap(ctx context.Context, nodeConfig *daemonconfig

restConfig, err := clientcmd.BuildConfigFromFlags("", nodeConfig.AgentConfig.KubeConfigK3sController)

p.CNIName, err = getCniPluginName(restConfig)
p.CNIName, err = getCNIPluginName(restConfig)
if err != nil {
return err
}

switch p.CNIName {
case "", CNICalico:
p.CniPlugin = &win.Calico{}
if err := p.CniPlugin.Setup(ctx, nodeConfig, restConfig, p.DataDir); err != nil {
p.CNIPlugin = &win.Calico{}
if err := p.CNIPlugin.Setup(ctx, nodeConfig, restConfig, p.DataDir); err != nil {
return err
}
case CNINone:
Expand Down Expand Up @@ -160,7 +160,7 @@ func (p *PEBinaryConfig) Kubelet(ctx context.Context, args []string) error {
cniCtx, cancel := context.WithCancel(ctx)
if p.CNIName != CNINone {
go func() {
if err := p.CniPlugin.Start(cniCtx); err != nil {
if err := p.CNIPlugin.Start(cniCtx); err != nil {
logrus.Errorf("error in cni start: %s", err)
}
}()
Expand All @@ -185,8 +185,8 @@ func (p *PEBinaryConfig) KubeProxy(ctx context.Context, args []string) error {
return nil
}

CNIConfig := p.CniPlugin.GetConfig()
vip, err := p.CniPlugin.ReserveSourceVip(ctx)
CNIConfig := p.CNIPlugin.GetConfig()
vip, err := p.CNIPlugin.ReserveSourceVip(ctx)
if err != nil || vip == "" {
logrus.Errorf("Failed to reserve VIP for kube-proxy: %s", err)
}
Expand Down Expand Up @@ -277,7 +277,7 @@ func getArgs(argsMap map[string]string) []string {
return args
}

func getCniPluginName(restConfig *rest.Config) (string, error) {
func getCNIPluginName(restConfig *rest.Config) (string, error) {
hc, err := helm.NewFactoryFromConfig(restConfig)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion pkg/windows/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"k8s.io/client-go/rest"
)

type CniPlugin interface {
type CNIPlugin interface {
Setup(ctx context.Context, nodeConfig *daemonconfig.Node, restConfig *rest.Config, dataDir string) error
Start(ctx context.Context) error
GetConfig() *CNICommonConfig
Expand Down

0 comments on commit f827656

Please sign in to comment.