@@ -27,8 +27,6 @@ import (
2727
2828 "github.com/Azure/agentbaker/aks-node-controller/helpers"
2929 aksnodeconfigv1 "github.com/Azure/agentbaker/aks-node-controller/pkg/gen/aksnodeconfig/v1"
30- "github.com/Azure/agentbaker/pkg/agent"
31- "github.com/Azure/agentbaker/pkg/agent/datamodel"
3230 "github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
3331 "github.com/google/go-cmp/cmp"
3432)
@@ -1382,47 +1380,6 @@ func Test_getKubeletFlags(t *testing.T) {
13821380 type args struct {
13831381 kubeletConfig * aksnodeconfigv1.KubeletConfig
13841382 }
1385- kubeletFlags := map [string ]string {
1386- "--address" : "0.0.0.0" ,
1387- "--pod-manifest-path" : "/etc/kubernetes/manifests" ,
1388- "--cluster-domain" : "cluster.local" ,
1389- "--cluster-dns" : "10.0.0.10" ,
1390- "--cgroups-per-qos" : "true" ,
1391- "--tls-cert-file" : "/etc/kubernetes/certs/kubeletserver.crt" ,
1392- "--tls-private-key-file" : "/etc/kubernetes/certs/kubeletserver.key" ,
1393- "--tls-cipher-suites" : "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256" , //nolint:lll
1394- "--max-pods" : "110" ,
1395- "--node-status-update-frequency" : "10s" ,
1396- "--image-gc-high-threshold" : "85" ,
1397- "--image-gc-low-threshold" : "80" ,
1398- "--event-qps" : "0" ,
1399- "--pod-max-pids" : "-1" ,
1400- "--enforce-node-allocatable" : "pods" ,
1401- "--streaming-connection-idle-timeout" : "4h0m0s" ,
1402- "--rotate-certificates" : "true" ,
1403- "--rotate-server-certificates" : "true" ,
1404- "--read-only-port" : "10255" ,
1405- "--protect-kernel-defaults" : "true" ,
1406- "--resolv-conf" : "/etc/resolv.conf" ,
1407- "--anonymous-auth" : "false" ,
1408- "--client-ca-file" : "/etc/kubernetes/certs/ca.crt" ,
1409- "--authentication-token-webhook" : "true" ,
1410- "--authorization-mode" : "Webhook" ,
1411- "--eviction-hard" : "memory.available<750Mi,nodefs.available<10%,nodefs.inodesFree<5%" ,
1412- "--feature-gates" : "RotateKubeletServerCertificate=true,DynamicKubeletConfig=false" , //nolint:lll // what if you turn off dynamic kubelet using dynamic kubelet?
1413- "--system-reserved" : "cpu=2,memory=1Gi" ,
1414- "--kube-reserved" : "cpu=100m,memory=1638Mi" ,
1415- }
1416- config := & datamodel.NodeBootstrappingConfiguration {
1417- KubeletConfig : kubeletFlags ,
1418- ContainerService : & datamodel.ContainerService {
1419- Location : "southcentralus" ,
1420- Type : "Microsoft.ContainerService/ManagedClusters" ,
1421- Properties : & datamodel.Properties {},
1422- },
1423- EnableKubeletConfigFile : false ,
1424- AgentPoolProfile : & datamodel.AgentPoolProfile {},
1425- }
14261383 tests := []struct {
14271384 name string
14281385 args args
@@ -1432,24 +1389,45 @@ func Test_getKubeletFlags(t *testing.T) {
14321389 name : "Default KubeletFlags" ,
14331390 args : args {
14341391 kubeletConfig : & aksnodeconfigv1.KubeletConfig {
1435- KubeletFlags : kubeletFlags ,
1436- },
1437- },
1438- want : expectedKubeletConfigFlags ,
1439- },
1440- {
1441- name : "Default KubeletCmdFlags" ,
1442- args : args {
1443- kubeletConfig : & aksnodeconfigv1.KubeletConfig {
1444- KubeletCmdFlags : agent .GetOrderedKubeletConfigFlagString (config ),
1392+ KubeletFlags : map [string ]string {
1393+ "--address" : "0.0.0.0" ,
1394+ "--pod-manifest-path" : "/etc/kubernetes/manifests" ,
1395+ "--cluster-domain" : "cluster.local" ,
1396+ "--cluster-dns" : "10.0.0.10" ,
1397+ "--cgroups-per-qos" : "true" ,
1398+ "--tls-cert-file" : "/etc/kubernetes/certs/kubeletserver.crt" ,
1399+ "--tls-private-key-file" : "/etc/kubernetes/certs/kubeletserver.key" ,
1400+ "--tls-cipher-suites" : "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256" , //nolint:lll
1401+ "--max-pods" : "110" ,
1402+ "--node-status-update-frequency" : "10s" ,
1403+ "--image-gc-high-threshold" : "85" ,
1404+ "--image-gc-low-threshold" : "80" ,
1405+ "--event-qps" : "0" ,
1406+ "--pod-max-pids" : "-1" ,
1407+ "--enforce-node-allocatable" : "pods" ,
1408+ "--streaming-connection-idle-timeout" : "4h0m0s" ,
1409+ "--rotate-certificates" : "true" ,
1410+ "--rotate-server-certificates" : "true" ,
1411+ "--read-only-port" : "10255" ,
1412+ "--protect-kernel-defaults" : "true" ,
1413+ "--resolv-conf" : "/etc/resolv.conf" ,
1414+ "--anonymous-auth" : "false" ,
1415+ "--client-ca-file" : "/etc/kubernetes/certs/ca.crt" ,
1416+ "--authentication-token-webhook" : "true" ,
1417+ "--authorization-mode" : "Webhook" ,
1418+ "--eviction-hard" : "memory.available<750Mi,nodefs.available<10%,nodefs.inodesFree<5%" ,
1419+ "--feature-gates" : "RotateKubeletServerCertificate=true,DynamicKubeletConfig=false" , //nolint:lll // what if you turn off dynamic kubelet using dynamic kubelet?
1420+ "--system-reserved" : "cpu=2,memory=1Gi" ,
1421+ "--kube-reserved" : "cpu=100m,memory=1638Mi" ,
1422+ },
14451423 },
14461424 },
14471425 want : expectedKubeletConfigFlags ,
14481426 },
14491427 }
14501428 for _ , tt := range tests {
14511429 t .Run (tt .name , func (t * testing.T ) {
1452- if got := getKubeletFlags (tt .args .kubeletConfig ); strings . TrimSpace ( got ) != strings . TrimSpace ( tt .want ) {
1430+ if got := getKubeletFlags (tt .args .kubeletConfig ); got != tt .want {
14531431 t .Errorf ("getKubeletFlags() = %v, want %v" , got , tt .want )
14541432 }
14551433 })
0 commit comments