Skip to content

Commit

Permalink
Add soft eviction to bottlerocket
Browse files Browse the repository at this point in the history
  • Loading branch information
lolbrish committed Jun 20, 2024
1 parent 2e907f9 commit 61c9ba3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
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 @@ func (b Bottlerocket) Script() (string, error) {
if b.KubeletConfig.EvictionHard != nil {
s.Settings.Kubernetes.EvictionHard = b.KubeletConfig.EvictionHard
}
if b.KubeletConfig.EvictionMaxPodGracePeriod != nil {
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,
EvictionSoftEnabled: true,
SupportsENILimitedPodDensity: true,
}
}

0 comments on commit 61c9ba3

Please sign in to comment.