Skip to content

Commit

Permalink
refactor(platform): remove EnsureDisableOffloading (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Ryu authored Apr 6, 2022
1 parent ec49db1 commit a192e06
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 33 deletions.
16 changes: 0 additions & 16 deletions pkg/platform/provider/baremetal/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,6 @@ func (p *Provider) EnsureDisableSwap(ctx context.Context, c *v1.Cluster) error {
return nil
}

func (p *Provider) EnsureDisableOffloading(ctx context.Context, c *v1.Cluster) error {
for _, machine := range c.Spec.Machines {
machineSSH, err := machine.SSH()
if err != nil {
return err
}

_, err = machineSSH.CombinedOutput(`ethtool --offload flannel.1 rx off tx off || true`)
if err != nil {
return errors.Wrap(err, machine.IP)
}
}

return nil
}

// 因为validate那里没法更新对象(不能存储)
// PreCrete,在api中错误只能panic,响应不会有报错提示,所以只能挪到这里处理
func (p *Provider) EnsureClusterComplete(ctx context.Context, cluster *v1.Cluster) error {
Expand Down
1 change: 0 additions & 1 deletion pkg/platform/provider/baremetal/cluster/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func NewProvider() (*Provider, error) {

p.EnsureCleanup,
p.EnsureCreateClusterMark,
p.EnsureDisableOffloading, // will remove it when upgrade to k8s v1.18.5
p.EnsurePostInstallHook,
p.EnsurePostClusterInstallHook,
},
Expand Down
15 changes: 1 addition & 14 deletions pkg/platform/provider/baremetal/machine/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"path"
"strings"
"time"

"tkestack.io/tke/pkg/platform/provider/baremetal/phases/image"

"github.com/imdario/mergo"
Expand Down Expand Up @@ -236,20 +237,6 @@ func (p *Provider) EnsureDisableSwap(ctx context.Context, machine *platformv1.Ma
return nil
}

func (p *Provider) EnsureDisableOffloading(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error {
machineSSH, err := machine.Spec.SSH()
if err != nil {
return err
}

_, err = machineSSH.CombinedOutput(`ethtool --offload flannel.1 rx off tx off || true`)
if err != nil {
return err
}

return nil
}

func (p *Provider) EnsureManifestDir(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error {
machineSSH, err := machine.Spec.SSH()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/platform/provider/baremetal/machine/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func NewProvider() (*Provider, error) {
p.EnsureKubeconfig,
p.EnsureMarkNode,
p.EnsureNodeReady,
p.EnsureDisableOffloading, // will remove it when upgrade to k8s v1.18.5
p.EnsurePostInstallHook,
},
UpdateHandlers: []machineprovider.Handler{
Expand Down
1 change: 0 additions & 1 deletion pkg/platform/provider/edge/cluster/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func NewProvider() (*Provider, error) {

p.bCluster.EnsureCleanup,
p.bCluster.EnsureCreateClusterMark,
p.bCluster.EnsureDisableOffloading, // will remove it when upgrade to k8s v1.18.5
p.bCluster.EnsurePostInstallHook,
p.bCluster.EnsurePostClusterInstallHook,
},
Expand Down

0 comments on commit a192e06

Please sign in to comment.