Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add machine annotation to specify MaxParallelImagePulls #61

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/apis/cluster/common/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const (
ExternalCloudProviderKubeletFlag KubeletFlags = "ExternalCloudProvider"
)

// Annotation suffixes, used with the KubeletConfig prefix, used on Machine objects to set fields of the KubeletConfig
const (
SystemReservedKubeletConfig = "SystemReserved"
KubeReservedKubeletConfig = "KubeReserved"
Expand All @@ -143,10 +144,11 @@ const (
MaxPodsKubeletConfig = "MaxPods"
ImageGCLowThresholdPercentKubeletConfig = "ImageGCLowThresholdPercent"
ImageGCHighThresholdPercentKubeletConfig = "ImageGCHighThresholdPercent"
MaxParallelImagePullsKubeletConfig = "MaxParallelImagePulls"
)

// Annotation prefixes, used on Machine objects to indicate the parameters that been used to create those Machines.
const (
// Annotation prefixes, used on Machine objects to indicate the parameters that been used to create those Machines.
KubeletFeatureGatesAnnotationPrefixV1 = "v1.kubelet-featuregates.machine-controller.kubermatic.io"
KubeletFlagsGroupAnnotationPrefixV1 = "v1.kubelet-flags.machine-controller.kubermatic.io"
KubeletConfigAnnotationPrefixV1 = "v1.kubelet-config.machine-controller.kubermatic.io"
Expand Down
12 changes: 12 additions & 0 deletions pkg/userdata/helper/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ func kubeletConfiguration(log *zap.SugaredLogger, clusterDomain string, clusterD
}
}

if maxParallelImagePulls, ok := kubeletConfigs[common.MaxParallelImagePullsKubeletConfig]; ok {
val, err := strconv.ParseInt(maxParallelImagePulls, 10, 32)
if err != nil || val < 1 {
// Instead of breaking the workflow, just print a warning and skip the configuration
log.Info("Skipping invalid MaxParallelImagePulls value for Kubelet configuration", "value", maxParallelImagePulls)
} else {
i32val := int32(val)
cfg.SerializeImagePulls = ptr.To(false)
cfg.MaxParallelImagePulls = &i32val
}
}

if enabled, ok := featureGates["SeccompDefault"]; ok && enabled {
cfg.SeccompDefault = ptr.To(true)
}
Expand Down
Loading