Skip to content

Commit

Permalink
Drop ENILimitedPodDensity option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Oct 1, 2024
1 parent 6067ccb commit 90d9043
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 38 deletions.
19 changes: 9 additions & 10 deletions pkg/providers/amifamily/al2023.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ func (a AL2023) resolvePath(architecture, variant, k8sVersion, amiVersion string
func (a AL2023) UserData(kubeletConfig *v1.KubeletConfiguration, taints []corev1.Taint, labels map[string]string, caBundle *string, _ []*cloudprovider.InstanceType, customUserData *string, instanceStorePolicy *v1.InstanceStorePolicy) bootstrap.Bootstrapper {
return bootstrap.Nodeadm{
Options: bootstrap.Options{
ClusterName: a.Options.ClusterName,
ClusterEndpoint: a.Options.ClusterEndpoint,
ClusterCIDR: a.Options.ClusterCIDR,
KubeletConfig: kubeletConfig,
Taints: taints,
Labels: labels,
CABundle: caBundle,
AWSENILimitedPodDensity: false,
CustomUserData: customUserData,
InstanceStorePolicy: instanceStorePolicy,
ClusterName: a.Options.ClusterName,
ClusterEndpoint: a.Options.ClusterEndpoint,
ClusterCIDR: a.Options.ClusterCIDR,
KubeletConfig: kubeletConfig,
Taints: taints,
Labels: labels,
CABundle: caBundle,
CustomUserData: customUserData,
InstanceStorePolicy: instanceStorePolicy,
},
}
}
Expand Down
21 changes: 10 additions & 11 deletions pkg/providers/amifamily/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ import (

// Options is the node bootstrapping parameters passed from Karpenter to the provisioning node
type Options struct {
ClusterName string
ClusterEndpoint string
ClusterCIDR *string
KubeletConfig *v1.KubeletConfiguration
Taints []corev1.Taint `hash:"set"`
Labels map[string]string `hash:"set"`
CABundle *string
AWSENILimitedPodDensity bool
ContainerRuntime *string
CustomUserData *string
InstanceStorePolicy *v1.InstanceStorePolicy
ClusterName string
ClusterEndpoint string
ClusterCIDR *string
KubeletConfig *v1.KubeletConfiguration
Taints []corev1.Taint `hash:"set"`
Labels map[string]string `hash:"set"`
CABundle *string
ContainerRuntime *string
CustomUserData *string
InstanceStorePolicy *v1.InstanceStorePolicy
}

func (o Options) kubeletExtraArgs() (args []string) {
Expand Down
3 changes: 0 additions & 3 deletions pkg/providers/amifamily/bootstrap/bottlerocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ func (b Bottlerocket) Script() (string, error) {
return "", err
}

// Backwards compatibility for AWSENILimitedPodDensity flag
if b.KubeletConfig != nil && b.KubeletConfig.MaxPods != nil {
s.Settings.Kubernetes.MaxPods = aws.Int(int(lo.FromPtr(b.KubeletConfig.MaxPods)))
} else if !b.AWSENILimitedPodDensity {
s.Settings.Kubernetes.MaxPods = aws.Int(110)
}

if b.KubeletConfig != nil {
Expand Down
13 changes: 1 addition & 12 deletions pkg/providers/amifamily/bootstrap/eksbootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (e EKS) eksBootstrapScript() string {
if e.KubeletConfig != nil && len(e.KubeletConfig.ClusterDNS) > 0 {
userData.WriteString(fmt.Sprintf(" \\\n--dns-cluster-ip '%s'", e.KubeletConfig.ClusterDNS[0]))
}
if (e.KubeletConfig != nil && e.KubeletConfig.MaxPods != nil) || !e.AWSENILimitedPodDensity {
if e.KubeletConfig != nil && e.KubeletConfig.MaxPods != nil {
userData.WriteString(" \\\n--use-max-pods false")
}
if args := e.kubeletExtraArgs(); len(args) > 0 {
Expand All @@ -83,17 +83,6 @@ func (e EKS) eksBootstrapScript() string {
return userData.String()
}

// kubeletExtraArgs for the EKS bootstrap.sh script uses the concept of ENI-limited pod density to set pods
// If this argument is explicitly disabled, then set the max-pods value on the kubelet to the static value of 110
func (e EKS) kubeletExtraArgs() []string {
args := e.Options.kubeletExtraArgs()
// Set the static value for --max-pods to 110 when AWSENILimitedPodDensity is explicitly disabled and the value isn't set
if !e.AWSENILimitedPodDensity && (e.KubeletConfig == nil || e.KubeletConfig.MaxPods == nil) {
args = append(args, "--max-pods=110")
}
return args
}

func (e EKS) mergeCustomUserData(userDatas ...string) (string, error) {
var outputBuffer bytes.Buffer
writer := multipart.NewWriter(&outputBuffer)
Expand Down
3 changes: 1 addition & 2 deletions pkg/providers/launchtemplate/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ var _ = Describe("LaunchTemplate Provider", func() {
{Taints: []corev1.Taint{{Key: "test-key", Value: "test-value"}}},
{Labels: map[string]string{"test-key": "test-value"}},
{CABundle: lo.ToPtr("test-bundle")},
{AWSENILimitedPodDensity: true},
{ContainerRuntime: lo.ToPtr("test-cri")},
{CustomUserData: lo.ToPtr("test-cidr")},
}
Expand All @@ -474,7 +473,7 @@ var _ = Describe("LaunchTemplate Provider", func() {
lt := &amifamily.LaunchTemplate{UserData: bootstrap.EKS{Options: *option}}
launchtemplateResult = append(launchtemplateResult, launchtemplate.LaunchTemplateName(lt))
}
Expect(len(launchtemplateResult)).To(BeNumerically("==", 10))
Expect(len(launchtemplateResult)).To(BeNumerically("==", 9))
Expect(lo.Uniq(launchtemplateResult)).To(Equal(launchtemplateResult))
})
It("should generate different launch template names based on launchtemplate option configuration", func() {
Expand Down

0 comments on commit 90d9043

Please sign in to comment.