Skip to content

Commit

Permalink
Revert "Set vttablet init container resource limits (#216)" (#244)
Browse files Browse the repository at this point in the history
This reverts commit be42288.
  • Loading branch information
nickvanw committed Jan 31, 2022
1 parent 00722ed commit 19384df
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
23 changes: 0 additions & 23 deletions pkg/operator/vttablet/mysqlctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package vttablet

import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/pointer"

planetscalev2 "planetscale.dev/vitess-operator/pkg/apis/planetscale/v2"
Expand Down Expand Up @@ -48,10 +47,6 @@ for mycnf in $(find . -mindepth 2 -maxdepth 2 -path './vt_*/my.cnf'); do
sed -i -e 's,^socket[ \t]*=.*$,socket = ` + mysqlSocketPath + `,' "${mycnf}"
done
`

defaultInitCPURequestMillis = 100
defaultInitMemoryRequestBytes = 32 * (1 << 20) // 32 MiB
defaultInitMemoryLimitBytes = 128 * (1 << 20) // 128 MiB
)

func init() {
Expand Down Expand Up @@ -91,15 +86,6 @@ func init() {
},
Command: []string{"bash", "-c"},
Args: []string{vtRootInitScript},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: *resource.NewMilliQuantity(defaultInitCPURequestMillis, resource.DecimalSI),
corev1.ResourceMemory: *resource.NewQuantity(defaultInitMemoryRequestBytes, resource.BinarySI),
},
Limits: corev1.ResourceList{
corev1.ResourceMemory: *resource.NewQuantity(defaultInitMemoryLimitBytes, resource.BinarySI),
},
},
},
}

Expand All @@ -122,15 +108,6 @@ func init() {
},
Command: []string{"bash", "-c"},
Args: []string{mysqlSocketInitScript},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: *resource.NewMilliQuantity(defaultInitCPURequestMillis, resource.DecimalSI),
corev1.ResourceMemory: *resource.NewQuantity(defaultInitMemoryRequestBytes, resource.BinarySI),
},
Limits: corev1.ResourceList{
corev1.ResourceMemory: *resource.NewQuantity(defaultInitMemoryLimitBytes, resource.BinarySI),
},
},
})
}

Expand Down
11 changes: 1 addition & 10 deletions pkg/operator/vttablet/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,9 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
}
}

// Set the resource requirements on each of the default vttablet init
// containers to the same values as the vttablet container itself in
// case the cluster requires them.
defaultTabletInitContainers := tabletInitContainers.Get(spec)
for i := range defaultTabletInitContainers {
c := &defaultTabletInitContainers[i]
update.ResourceRequirements(&c.Resources, &spec.Vttablet.Resources)
}

// Make the final list of desired containers and init containers.
initContainers := []corev1.Container{}
initContainers = append(initContainers, defaultTabletInitContainers...)
initContainers = append(initContainers, tabletInitContainers.Get(spec)...)
initContainers = append(initContainers, spec.InitContainers...)

sidecarContainers := []corev1.Container{}
Expand Down

0 comments on commit 19384df

Please sign in to comment.