From ac6356f6fe6d89856f088ab29c8adca6ba9340fa Mon Sep 17 00:00:00 2001 From: Beilei Huang Date: Mon, 17 Feb 2025 17:26:22 +1300 Subject: [PATCH] add e2e to verify node can be bootstrapped --- e2e/scenario_test.go | 19 +++++++++++++++++++ pkg/agent/utils.go | 1 + 2 files changed, 20 insertions(+) diff --git a/e2e/scenario_test.go b/e2e/scenario_test.go index 748e6ba116f..530237c518a 100644 --- a/e2e/scenario_test.go +++ b/e2e/scenario_test.go @@ -1664,3 +1664,22 @@ func Test_Ubuntu2404ARM(t *testing.T) { }, }) } + +func Test_Ubuntu2204_MetricsFromCRI(t *testing.T) { + RunScenario(t, &Scenario{ + Description: "tests that a node on ubuntu 2204 bootstrapped with metrics from CRI enabled will still have kubelet metrics", + Config: Config{ + Cluster: ClusterKubenet, + VHD: config.VHDUbuntu2204Gen2Containerd, + BootstrapConfigMutator: func(nbc *datamodel.NodeBootstrappingConfiguration) { + if nbc.KubeletConfig == nil { + nbc.KubeletConfig = map[string]string{} + } + nbc.KubeletConfig["--pod-container-stats-cri"] = "true" + }, + Validator: func(ctx context.Context, s *Scenario) { + ValidateFileHasContent(ctx, s, "/etc/default/kubelet", "--feature-gates=PodAndContainerStatsFromCRI=true") + }, + }, + }) +} diff --git a/pkg/agent/utils.go b/pkg/agent/utils.go index c0e2bec58c2..2df215d164a 100644 --- a/pkg/agent/utils.go +++ b/pkg/agent/utils.go @@ -45,6 +45,7 @@ var TranslatedKubeletConfigFlags = map[string]bool{ "--eviction-hard": true, "--node-status-update-frequency": true, "--node-status-report-frequency": true, + "--pod-container-stats-cri": true, "--image-gc-high-threshold": true, "--image-gc-low-threshold": true, "--event-qps": true,