Skip to content

Commit

Permalink
Add machine annotation to specify MaxParallelImagePulls
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef Mende committed May 29, 2024
1 parent bd35e45 commit 55259bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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 < 0 {
// 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

0 comments on commit 55259bb

Please sign in to comment.