Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
randytqwjp committed Dec 25, 2024
1 parent c076cc4 commit 8802f3b
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ status:
type: ScaledUpBasedOnPreferredMaxReplicas
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
message: The recommendation is provided
status: "True"
type: HPATargetUtilizationUpdated
type: VerticalRecommendationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
message: The recommendation is provided
message: HPA target utilization is updated
reason: HPATargetUtilizationUpdated
status: "True"
type: VerticalRecommendationUpdated
type: HPATargetUtilizationUpdated
- lastTransitionTime: "2023-01-01T00:00:00Z"
lastUpdateTime: "2023-01-01T00:00:00Z"
status: "False"
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/tortoise_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ func (r *TortoiseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_
return ctrl.Result{RequeueAfter: r.Interval}, nil
}

_, tortoise, err = r.HpaService.UpdateHPAFromTortoiseRecommendation(ctx, tortoise, now)
tortoise, err = r.TortoiseService.UpdateResourceRequest(ctx, tortoise, currentDesiredReplicaNum, now)
if err != nil {
logger.Error(err, "update HPA based on the recommendation in tortoise", "tortoise", req.NamespacedName)
logger.Error(err, "update VPA based on the recommendation in tortoise", "tortoise", req.NamespacedName)
return ctrl.Result{}, err
}

tortoise, err = r.TortoiseService.UpdateResourceRequest(ctx, tortoise, currentDesiredReplicaNum, now)
_, tortoise, err = r.HpaService.UpdateHPAFromTortoiseRecommendation(ctx, tortoise, now)
if err != nil {
logger.Error(err, "update VPA based on the recommendation in tortoise", "tortoise", req.NamespacedName)
logger.Error(err, "update HPA based on the recommendation in tortoise", "tortoise", req.NamespacedName)
return ctrl.Result{}, err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/hpa/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (c *Service) ChangeHPAFromTortoiseRecommendation(tortoise *autoscalingv1bet
cpu += value.AsApproximateFloat64()
}
if resourcename == corev1.ResourceMemory {
cpu += value.AsApproximateFloat64()
mem += value.AsApproximateFloat64()
}
}
}
Expand Down

0 comments on commit 8802f3b

Please sign in to comment.