feat;Updating script used to run kubelet to not set docker-specific kubelet args when using containerd (#4817)

Signed-off-by: Mark Rossetti <marosset@microsoft.com>
This commit is contained in:
Mark Rossetti 2022-01-20 12:25:38 -08:00 коммит произвёл GitHub
Родитель dc2cbf4896
Коммит 5963edd9c7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 34 добавлений и 15 удалений

Просмотреть файл

@ -318,7 +318,16 @@ func removeKubeletFlags(k map[string]string, v string) {
// Remove dockershim related flags in v1.24 and up
if common.IsKubernetesVersionGe(v, "1.24.0-alpha") {
for _, key := range []string{"--image-pull-progress-deadline", "--network-plugin"} {
for _, key := range []string{
"--cni-conf-dir",
"--cni-bin-dir",
"--cni-cache-dir",
"--docker-endpoint",
"--experimental-dockershim-root-directory",
"--image-pull-progress-deadline",
"--network-plugin",
"--network-plugin-mtu",
} {
delete(k, key)
}
}

Просмотреть файл

@ -2423,9 +2423,15 @@ func TestRemoveKubeletFlags(t *testing.T) {
{
name: "v1.24.0",
kubeletConfig: map[string]string{
"--image-pull-progress-deadline": "30m",
"--network-plugin": "cni",
"--pod-max-pids": "100",
"--cni-conf-dir": "/opt/cni/conf",
"--cni-bin-dir": "/opt/cni/bin",
"--cni-cache-dir": "/opt/cni/cache",
"--docker-endpoint": "/docker.sock",
"--experimental-dockershim-root-directory": "/some/dir",
"--image-pull-progress-deadline": "30m",
"--network-plugin": "cni",
"--network-plugin-mtu": "2000",
"--pod-max-pids": "100",
},
expected: map[string]string{
"--pod-max-pids": "100",

Просмотреть файл

@ -39,17 +39,21 @@ $KubeletArgList += "--volume-plugin-dir=$global:VolumePluginDir"
# If you are thinking about adding another arg here, you should be considering pkg/engine/defaults-kubelet.go first
# Only args that need to be calculated or combined with other ones on the Windows agent should be added here.
# Configure kubelet to use CNI plugins if enabled.
if ($NetworkPlugin -eq "azure") {
$KubeletArgList += @("--cni-bin-dir=$AzureCNIBinDir", "--cni-conf-dir=$AzureCNIConfDir")
}
elseif ($NetworkPlugin -eq "kubenet") {
$KubeletArgList += @("--cni-bin-dir=$CNIPath", "--cni-conf-dir=$CNIConfigPath")
# handle difference in naming between Linux & Windows reference plugin
$KubeletArgList = $KubeletArgList -replace "kubenet", "cni"
}
else {
throw "Unknown network type $NetworkPlugin, can't configure kubelet"
if ($global:ContainerRuntime -eq "docker") {
# Configure kubelet to use CNI plugins if enabled.
# Note: --cni-bin-dir and --cni-conf-dir kubelet args are only used with dockershim and have been removed in v1.24
if ($NetworkPlugin -eq "azure") {
$KubeletArgList += @("--cni-bin-dir=$AzureCNIBinDir", "--cni-conf-dir=$AzureCNIConfDir")
}
elseif ($NetworkPlugin -eq "kubenet") {
$KubeletArgList += @("--cni-bin-dir=$CNIPath", "--cni-conf-dir=$CNIConfigPath")
# handle difference in naming between Linux & Windows reference plugin
$KubeletArgList = $KubeletArgList -replace "kubenet", "cni"
}
else {
throw "Unknown network type $NetworkPlugin, can't configure kubelet"
}
}
# Update args to use ContainerD if needed