Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add soft eviction setting to Bottlerocket kublet config #6390

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/providers/amifamily/bootstrap/bottlerocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
if b.KubeletConfig.EvictionHard != nil {
s.Settings.Kubernetes.EvictionHard = b.KubeletConfig.EvictionHard
}
if b.KubeletConfig.EvictionMaxPodGracePeriod != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test (at least a functional one) for the changes that you are making here. There may also be a change that you could make to the current E2E integration testing in our Kubelet Config suite tests that would extend eviction soft testing for BR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to take a look at this in the next few days

s.Settings.Kubernetes.EvictionMaxPodGracePeriod = aws.Int(int(ptr.Int32Value(b.KubeletConfig.EvictionMaxPodGracePeriod)))

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / Analyze Go

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.23.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci

undefined: ptr (typecheck)

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci

undefined: ptr) (typecheck)

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci

undefined: ptr) (typecheck)

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.24.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.25.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.26.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.27.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.28.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.29.x)

undefined: ptr

Check failure on line 68 in pkg/providers/amifamily/bootstrap/bottlerocket.go

View workflow job for this annotation

GitHub Actions / ci-test (1.30.x)

undefined: ptr
}
if b.KubeletConfig.EvictionSoft != nil {
s.Settings.Kubernetes.EvictionSoft = b.KubeletConfig.EvictionSoft
}
if b.KubeletConfig.EvictionSoftGracePeriod != nil {
s.Settings.Kubernetes.EvictionSoftGracePeriod = make(map[string]string)
for k, v := range b.KubeletConfig.EvictionSoftGracePeriod {
s.Settings.Kubernetes.EvictionSoftGracePeriod[k] = v.Duration.String()
}
}
if b.KubeletConfig.ImageGCHighThresholdPercent != nil {
s.Settings.Kubernetes.ImageGCHighThresholdPercent = lo.ToPtr(strconv.FormatInt(int64(*b.KubeletConfig.ImageGCHighThresholdPercent), 10))
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/providers/amifamily/bootstrap/bottlerocketsettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type BottlerocketKubernetes struct {
MaxPods *int `toml:"max-pods,omitempty"`
StaticPods map[string]BottlerocketStaticPod `toml:"static-pods,omitempty"`
EvictionHard map[string]string `toml:"eviction-hard,omitempty"`
EvictionMaxPodGracePeriod *int `toml:"eviction-max-pod-grace-period,omitempty"`
EvictionSoft map[string]string `toml:"eviction-soft,omitempty"`
EvictionSoftGracePeriod map[string]string `toml:"eviction-soft-grace-period,omitempty"`
KubeReserved map[string]string `toml:"kube-reserved,omitempty"`
SystemReserved map[string]string `toml:"system-reserved,omitempty"`
AllowedUnsafeSysctls []string `toml:"allowed-unsafe-sysctls,omitempty"`
Expand Down
8 changes: 1 addition & 7 deletions pkg/providers/amifamily/bottlerocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,11 @@ func (b Bottlerocket) EphemeralBlockDevice() *string {
// podsPerCore will be ignored
// https://github.com/bottlerocket-os/bottlerocket/issues/1721

// EvictionSoftEnabled is currently disabled for Bottlerocket AMIFamily because it does
// not currently support the evictionSoft parameter passed through the kubernetes settings TOML userData
// If a NodePool sets the evictionSoft value when using the Bottlerocket AMIFamily in the provider,
// evictionSoft will be ignored
// https://github.com/bottlerocket-os/bottlerocket/issues/1445

func (b Bottlerocket) FeatureFlags() FeatureFlags {
return FeatureFlags{
UsesENILimitedMemoryOverhead: false,
PodsPerCoreEnabled: false,
EvictionSoftEnabled: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even think we need the feature flag at all now since I believe they are all true now. You can probably just drop the field outright from the struct now

EvictionSoftEnabled: true,
SupportsENILimitedPodDensity: true,
}
}
Loading