Skip to content

Commit

Permalink
Address review comments from vlerenc
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov committed May 15, 2024
1 parent f032b09 commit 656589f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions pkg/component/gardener/apiserver/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ var _ = Describe("GardenerAPIServer", func() {
{
ContainerName: "gardener-apiserver",
MinAllowed: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("400M"),
corev1.ResourceMemory: resource.MustParse("200M"),
},
MaxAllowed: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("7"),
Expand All @@ -316,7 +316,7 @@ var _ = Describe("GardenerAPIServer", func() {
},
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
MinReplicas: ptr.To[int32](2),
MaxReplicas: 4,
MaxReplicas: 6,
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
APIVersion: appsv1.SchemeGroupVersion.String(),
Kind: "Deployment",
Expand Down Expand Up @@ -1607,6 +1607,8 @@ kubeConfigFile: /etc/kubernetes/admission-kubeconfigs/validatingadmissionwebhook
Context("when autoscaling mode is VPAAndHPA", func() {
BeforeEach(func() {
values.Values.Autoscaling.Mode = apiserver.AutoscalingModeVPAAndHPA
values.Values.Autoscaling.MinReplicas = 2
values.Values.Autoscaling.MaxReplicas = 6
deployer = New(fakeClient, namespace, fakeSecretManager, values)
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/component/gardener/apiserver/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (g *gardenerAPIServer) horizontalPodAutoscalerInVPAAndHPAMode() *autoscalin
Labels: utils.MergeStringMaps(GetLabels(), map[string]string{resourcesv1alpha1.HighAvailabilityConfigType: resourcesv1alpha1.HighAvailabilityConfigTypeServer}),
},
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
MinReplicas: ptr.To[int32](2),
MaxReplicas: 4,
MinReplicas: ptr.To[int32](g.values.Autoscaling.MinReplicas),
MaxReplicas: g.values.Autoscaling.MaxReplicas,
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
APIVersion: appsv1.SchemeGroupVersion.String(),
Kind: "Deployment",
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/gardener/apiserver/vpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (g *gardenerAPIServer) verticalPodAutoscalerInVPAAndHPAMode() *vpaautoscali
{
ContainerName: containerName,
MinAllowed: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("400M"),
corev1.ResourceMemory: resource.MustParse("200M"),
},
MaxAllowed: corev1.ResourceList{
// The CPU and memory are aligned to the machine ration of 1:4.
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/controller/garden/garden/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func (r *Reconciler) newKubeAPIServer(

func defaultAPIServerAutoscalingConfig(garden *operatorv1alpha1.Garden) apiserver.AutoscalingConfig {
minReplicas := int32(2)
if garden.Spec.VirtualCluster.ControlPlane != nil && garden.Spec.VirtualCluster.ControlPlane.HighAvailability != nil {
if helper.HighAvailabilityEnabled(garden) {
minReplicas = 3
}

Expand Down

0 comments on commit 656589f

Please sign in to comment.