Skip to content

Commit 00311b4

Browse files
authored
docs: Add Auto Mode behavior change notices (#8513)
- Add prominent warning banner to auto-mode.md about upcoming default behavior change - Inform users that managed node groups will no longer be created by default
1 parent 8e3a4e7 commit 00311b4

4 files changed

Lines changed: 197 additions & 0 deletions

File tree

pkg/ctl/create/cluster.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/weaveworks/eksctl/pkg/kubernetes"
3737
"github.com/weaveworks/eksctl/pkg/outposts"
3838
"github.com/weaveworks/eksctl/pkg/printers"
39+
"github.com/weaveworks/eksctl/pkg/utils/deprecation"
3940
"github.com/weaveworks/eksctl/pkg/utils/kubeconfig"
4041
"github.com/weaveworks/eksctl/pkg/utils/names"
4142
"github.com/weaveworks/eksctl/pkg/utils/nodes"
@@ -306,6 +307,9 @@ func doCreateCluster(cmd *cmdutils.Cmd, ngFilter *filter.NodeGroupFilter, params
306307
return err
307308
}
308309

310+
// Check for Auto Mode deprecation warning
311+
deprecation.CheckAutoModeDeprecation(cfg)
312+
309313
logger.Info("using Kubernetes version %s", meta.Version)
310314
logger.Info("creating %s", cfg.LogString())
311315

pkg/utils/deprecation/auto_mode.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package deprecation
2+
3+
import (
4+
"github.com/kris-nova/logger"
5+
"github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
6+
)
7+
8+
// AutoModeDeprecationConfig holds deprecation warning settings
9+
type AutoModeDeprecationConfig struct {
10+
Message string
11+
DocumentationURL string
12+
LogLevel string
13+
}
14+
15+
// DefaultAutoModeDeprecationConfig returns default deprecation warning config
16+
func DefaultAutoModeDeprecationConfig() *AutoModeDeprecationConfig {
17+
return &AutoModeDeprecationConfig{
18+
Message: "Auto Mode will be enabled by default in an upcoming release of eksctl. " +
19+
"This means managed node groups and managed networking add-ons will no longer be created by default. " +
20+
"To maintain current behavior, explicitly set 'autoModeConfig.enabled: false' in your cluster configuration.",
21+
DocumentationURL: "https://eksctl.io/usage/auto-mode/",
22+
LogLevel: "warning",
23+
}
24+
}
25+
26+
// CheckAutoModeDeprecation shows deprecation warning if needed
27+
func CheckAutoModeDeprecation(cfg *v1alpha5.ClusterConfig) {
28+
if shouldShowAutoModeDeprecationWarning(cfg) {
29+
logAutoModeDeprecationWarning(DefaultAutoModeDeprecationConfig())
30+
}
31+
}
32+
33+
// CheckAutoModeDeprecationWithConfig shows deprecation warning with custom config
34+
func CheckAutoModeDeprecationWithConfig(cfg *v1alpha5.ClusterConfig, deprecationConfig *AutoModeDeprecationConfig) {
35+
if shouldShowAutoModeDeprecationWarning(cfg) {
36+
logAutoModeDeprecationWarning(deprecationConfig)
37+
}
38+
}
39+
40+
// shouldShowAutoModeDeprecationWarning returns true if warning should be shown
41+
func shouldShowAutoModeDeprecationWarning(cfg *v1alpha5.ClusterConfig) bool {
42+
// Show warning only when AutoMode is nil or Enabled is nil (not explicitly set)
43+
return cfg.AutoModeConfig == nil || cfg.AutoModeConfig.Enabled == nil
44+
}
45+
46+
// logAutoModeDeprecationWarning logs the deprecation warning
47+
func logAutoModeDeprecationWarning(config *AutoModeDeprecationConfig) {
48+
fullMessage := config.Message
49+
if config.DocumentationURL != "" {
50+
fullMessage += " Learn more: " + config.DocumentationURL
51+
}
52+
53+
// Log at configured level
54+
switch config.LogLevel {
55+
case "info":
56+
logger.Info(fullMessage)
57+
case "warning":
58+
logger.Warning(fullMessage)
59+
default:
60+
logger.Warning(fullMessage)
61+
}
62+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package deprecation
2+
3+
import (
4+
"testing"
5+
6+
"github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
7+
)
8+
9+
func TestShouldShowAutoModeDeprecationWarning_NilConfig(t *testing.T) {
10+
cfg := &v1alpha5.ClusterConfig{
11+
AutoModeConfig: nil,
12+
}
13+
14+
result := shouldShowAutoModeDeprecationWarning(cfg)
15+
if !result {
16+
t.Error("Expected warning to be shown when AutoModeConfig is nil")
17+
}
18+
}
19+
20+
func TestShouldShowAutoModeDeprecationWarning_NilEnabled(t *testing.T) {
21+
cfg := &v1alpha5.ClusterConfig{
22+
AutoModeConfig: &v1alpha5.AutoModeConfig{
23+
Enabled: nil,
24+
},
25+
}
26+
27+
result := shouldShowAutoModeDeprecationWarning(cfg)
28+
if !result {
29+
t.Error("Expected warning to be shown when AutoModeConfig.Enabled is nil")
30+
}
31+
}
32+
33+
func TestShouldShowAutoModeDeprecationWarning_ExplicitlyFalse(t *testing.T) {
34+
enabled := false
35+
cfg := &v1alpha5.ClusterConfig{
36+
AutoModeConfig: &v1alpha5.AutoModeConfig{
37+
Enabled: &enabled,
38+
},
39+
}
40+
41+
result := shouldShowAutoModeDeprecationWarning(cfg)
42+
if result {
43+
t.Error("Expected no warning when AutoModeConfig.Enabled is explicitly false")
44+
}
45+
}
46+
47+
func TestShouldShowAutoModeDeprecationWarning_ExplicitlyTrue(t *testing.T) {
48+
enabled := true
49+
cfg := &v1alpha5.ClusterConfig{
50+
AutoModeConfig: &v1alpha5.AutoModeConfig{
51+
Enabled: &enabled,
52+
},
53+
}
54+
55+
result := shouldShowAutoModeDeprecationWarning(cfg)
56+
if result {
57+
t.Error("Expected no warning when AutoModeConfig.Enabled is explicitly true")
58+
}
59+
}
60+
61+
func TestDefaultAutoModeDeprecationConfig(t *testing.T) {
62+
config := DefaultAutoModeDeprecationConfig()
63+
64+
if config.Message == "" {
65+
t.Error("Expected default message to be non-empty")
66+
}
67+
68+
if config.DocumentationURL == "" {
69+
t.Error("Expected default documentation URL to be non-empty")
70+
}
71+
72+
if config.LogLevel != "warning" {
73+
t.Errorf("Expected default log level to be 'warning', got '%s'", config.LogLevel)
74+
}
75+
76+
expectedMessage := "Auto Mode will be enabled by default in an upcoming release of eksctl. " +
77+
"This means managed node groups and managed networking add-ons will no longer be created by default. " +
78+
"To maintain current behavior, explicitly set 'autoModeConfig.enabled: false' in your cluster configuration."
79+
80+
if config.Message != expectedMessage {
81+
t.Errorf("Expected default message to match specification")
82+
}
83+
}
84+
85+
func TestCheckAutoModeDeprecation_WithNilConfig(t *testing.T) {
86+
cfg := &v1alpha5.ClusterConfig{
87+
AutoModeConfig: nil,
88+
}
89+
90+
// This test verifies the function doesn't panic and executes the warning logic
91+
// We can't easily test the actual logging without mocking the logger
92+
CheckAutoModeDeprecation(cfg)
93+
}
94+
95+
func TestCheckAutoModeDeprecation_WithExplicitlySetConfig(t *testing.T) {
96+
enabled := false
97+
cfg := &v1alpha5.ClusterConfig{
98+
AutoModeConfig: &v1alpha5.AutoModeConfig{
99+
Enabled: &enabled,
100+
},
101+
}
102+
103+
// This test verifies the function doesn't show warning when explicitly set
104+
// Since we can't easily mock the logger, we just ensure it doesn't panic
105+
CheckAutoModeDeprecation(cfg)
106+
}
107+
108+
func TestCheckAutoModeDeprecationWithConfig_CustomConfig(t *testing.T) {
109+
cfg := &v1alpha5.ClusterConfig{
110+
AutoModeConfig: nil,
111+
}
112+
113+
customConfig := &AutoModeDeprecationConfig{
114+
Message: "Custom test message",
115+
DocumentationURL: "https://example.com",
116+
LogLevel: "info",
117+
}
118+
119+
// This test verifies the function accepts custom configuration
120+
CheckAutoModeDeprecationWithConfig(cfg, customConfig)
121+
}

userdocs/src/usage/auto-mode.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# EKS Auto Mode
22

3+
> **⚠️ UPCOMING BEHAVIOR CHANGE**
4+
>
5+
> Auto Mode will be enabled by default in an upcoming release of eksctl.
6+
> This means managed node groups will no longer be created by default when creating clusters.
7+
>
8+
> **If you want to maintain the current behavior** (creating managed node groups and networking add-ons - VPC-CNI, CoreDNS, kube-proxy by default),
9+
> you must explicitly set `autoModeConfig.enabled: false` in your cluster configuration.
10+
>
11+
> This change affects clusters created without an explicit `autoModeConfig` section.
12+
313
## Introduction
414

515
eksctl supports [EKS Auto Mode][eks-user-guide], a feature that extends AWS management of Kubernetes clusters beyond the cluster itself,

0 commit comments

Comments
 (0)