Skip to content

Commit

Permalink
conntrack-fix container: Disable autoscaling (#9953)
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov authored Jun 10, 2024
1 parent e6f417f commit 79c8111
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
4 changes: 3 additions & 1 deletion pkg/component/kubernetes/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,13 @@ metadata:
spec:
resourcePolicy:
containerPolicies:
- containerName: '*'
- containerName: kube-proxy
controlledValues: RequestsOnly
maxAllowed:
cpu: "4"
memory: 10G
- containerName: conntrack-fix
mode: "Off"
targetRef:
apiVersion: apps/v1
kind: DaemonSet
Expand Down
27 changes: 17 additions & 10 deletions pkg/component/kubernetes/proxy/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ const (
// ConfigNamePrefix is the prefix for the name of the kube-proxy ConfigMap.
ConfigNamePrefix = "kube-proxy-config"

containerName = "kube-proxy"
serviceName = "kube-proxy"
containerName = "kube-proxy"
containerNameConntrackFix = "conntrack-fix"
serviceName = "kube-proxy"

portNameMetrics = "metrics"
portMetrics = 10249
Expand Down Expand Up @@ -250,7 +251,7 @@ func (k *kubeProxy) computePoolResourcesData(pool WorkerPool) (map[string][]byte
k.getKubeProxyContainer(k8sGreaterEqual129, pool.Image, false),
{
// sidecar container with fix for conntrack
Name: "conntrack-fix",
Name: containerNameConntrackFix,
Image: k.values.ImageAlpine,
ImagePullPolicy: corev1.PullIfNotPresent,
Command: []string{
Expand Down Expand Up @@ -400,14 +401,20 @@ func (k *kubeProxy) computePoolResourcesDataForMajorMinorVersionOnly(pool Worker
UpdateMode: &vpaUpdateMode,
},
ResourcePolicy: &vpaautoscalingv1.PodResourcePolicy{
ContainerPolicies: []vpaautoscalingv1.ContainerResourcePolicy{{
ContainerName: vpaautoscalingv1.DefaultContainerResourcePolicy,
MaxAllowed: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("4"),
corev1.ResourceMemory: resource.MustParse("10G"),
ContainerPolicies: []vpaautoscalingv1.ContainerResourcePolicy{
{
ContainerName: containerName,
MaxAllowed: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("4"),
corev1.ResourceMemory: resource.MustParse("10G"),
},
ControlledValues: &controlledValues,
},
{
ContainerName: containerNameConntrackFix,
Mode: ptr.To(vpaautoscalingv1.ContainerScalingModeOff),
},
ControlledValues: &controlledValues,
}},
},
},
},
}
Expand Down

0 comments on commit 79c8111

Please sign in to comment.