Skip to content

Commit

Permalink
Removing ethtool DS (#6785)
Browse files Browse the repository at this point in the history
  • Loading branch information
taneyland authored Oct 9, 2023
1 parent 8c247c8 commit 5a7934c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 339 deletions.
33 changes: 0 additions & 33 deletions pkg/providers/vsphere/config/ethtool_daemonset.yaml

This file was deleted.

44 changes: 4 additions & 40 deletions pkg/providers/vsphere/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 0 additions & 66 deletions pkg/providers/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import (

"github.com/Masterminds/sprig"
etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"

"github.com/aws/eks-anywhere/pkg/api/v1alpha1"
"github.com/aws/eks-anywhere/pkg/bootstrapper"
"github.com/aws/eks-anywhere/pkg/clients/kubernetes"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-anywhere/pkg/config"
"github.com/aws/eks-anywhere/pkg/constants"
Expand All @@ -31,7 +28,6 @@ import (
"github.com/aws/eks-anywhere/pkg/providers"
"github.com/aws/eks-anywhere/pkg/providers/common"
"github.com/aws/eks-anywhere/pkg/retrier"
"github.com/aws/eks-anywhere/pkg/templater"
"github.com/aws/eks-anywhere/pkg/types"
"github.com/aws/eks-anywhere/pkg/validations"
releasev1alpha1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
Expand All @@ -53,7 +49,6 @@ const (
disk1 = "Hard disk 1"
disk2 = "Hard disk 2"
MemoryAvailable = "Memory_Available"
ethtoolDaemonSetName = "vsphere-disable-udp-offload"
)

//go:embed config/template-cp.yaml
Expand All @@ -65,9 +60,6 @@ var defaultClusterConfigMD string
//go:embed config/secret.yaml
var defaultSecretObject string

//go:embed config/ethtool_daemonset.yaml
var ethtoolDaemonSetObject string

var (
eksaVSphereDatacenterResourceType = fmt.Sprintf("vspheredatacenterconfigs.%s", v1alpha1.GroupVersion.Group)
eksaVSphereMachineResourceType = fmt.Sprintf("vspheremachineconfigs.%s", v1alpha1.GroupVersion.Group)
Expand Down Expand Up @@ -145,8 +137,6 @@ type ProviderKubectlClient interface {
DeleteEksaDatacenterConfig(ctx context.Context, vsphereDatacenterResourceType string, vsphereDatacenterConfigName string, kubeconfigFile string, namespace string) error
DeleteEksaMachineConfig(ctx context.Context, vsphereMachineResourceType string, vsphereMachineConfigName string, kubeconfigFile string, namespace string) error
ApplyTolerationsFromTaintsToDaemonSet(ctx context.Context, oldTaints []corev1.Taint, newTaints []corev1.Taint, dsName string, kubeconfigFile string) error
GetDaemonSet(ctx context.Context, name, namespace, kubeconfig string) (*appsv1.DaemonSet, error)
Delete(ctx context.Context, resourceType, kubeconfig string, opts ...kubernetes.KubectlDeleteOption) error
}

// IPValidator is an interface that defines methods to validate the control plane IP.
Expand Down Expand Up @@ -1271,15 +1261,6 @@ func (p *vsphereProvider) InstallCustomProviderComponents(ctx context.Context, k

// PostBootstrapDeleteForUpgrade runs any provider-specific operations after bootstrap cluster has been deleted.
func (p *vsphereProvider) PostBootstrapDeleteForUpgrade(ctx context.Context, cluster *types.Cluster) error {
// Delete the daemonset that was used to disable udp offloading in ubuntu/redhat nodes.
logger.V(3).Info("Deleting vsphere-disable-udp-offload daemonset")
o := &kubernetes.KubectlDeleteOptions{
Name: ethtoolDaemonSetName,
Namespace: constants.EksaSystemNamespace,
}
if err := p.providerKubectlClient.Delete(ctx, "daemonset", cluster.KubeconfigFile, o); err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("deleting daemonset: %v", err)
}
return nil
}

Expand All @@ -1289,52 +1270,5 @@ func (p *vsphereProvider) PreCoreComponentsUpgrade(
cluster *types.Cluster,
clusterSpec *cluster.Spec,
) error {
// This is only needed for EKS-A v0.17 because UDP offloading needs to be disabled for
// the new Cilium version to work with VSphere clusters with Redhat OS family. Since our templates that were shipped
// in v0.16 releases still have UDP offloading enabled in the nodes, we must apply the daemon set
// to disable UDP offloading in all the nodes before upgrading Cilium.
// We will remove this in EKS-A release v0.18.0.
return p.applyEthtoolDaemonSet(ctx, cluster, clusterSpec)
}

func (p *vsphereProvider) applyEthtoolDaemonSet(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error {
for _, mc := range clusterSpec.Config.VSphereMachineConfigs {
// This is only needed for Redhat OS.
// We only need to check one since the OS family has to be the same for all machine configs
if mc.Spec.OSFamily != v1alpha1.RedHat {
return nil
}
}
logger.V(4).Info("Applying vsphere-disable-udp-offload daemonset")
bundle := clusterSpec.RootVersionsBundle()
values := map[string]interface{}{
"eksaSystemNamespace": constants.EksaSystemNamespace,
"kindNodeImage": bundle.EksD.KindNode.VersionedImage(),
}
b, err := templater.Execute(ethtoolDaemonSetObject, values)
if err != nil {
return err
}

if err = p.providerKubectlClient.ApplyKubeSpecFromBytes(ctx, cluster, b); err != nil {
return err
}

return p.Retrier.Retry(
func() error {
return p.checkEthtoolDaemonSetReady(ctx, cluster)
},
)
}

func (p *vsphereProvider) checkEthtoolDaemonSetReady(ctx context.Context, cluster *types.Cluster) error {
ethtoolDaemonSet, err := p.providerKubectlClient.GetDaemonSet(ctx, ethtoolDaemonSetName, constants.EksaSystemNamespace, cluster.KubeconfigFile)
if err != nil {
return err
}

if ethtoolDaemonSet.Status.DesiredNumberScheduled != ethtoolDaemonSet.Status.NumberReady {
return fmt.Errorf("daemonSet %s is not ready: %d/%d ready", ethtoolDaemonSetName, ethtoolDaemonSet.Status.NumberReady, ethtoolDaemonSet.Status.DesiredNumberScheduled)
}
return nil
}
Loading

0 comments on commit 5a7934c

Please sign in to comment.