Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1021,10 +1021,6 @@ k8s.io/sample-apiserver v0.22.2/go.mod h1:h+/DIV5EmuNq4vfPr5TSXy9mIBVXXlPAKQMPbj
k8s.io/system-validators v1.5.0/go.mod h1:bPldcLgkIUK22ALflnsXk8pvkTEndYdNuaHH6gRrl0Q=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kusionstack.io/kube-api v0.7.4-0.20251013070018-4c09604521e4 h1:VQS8BsRs7jXTY+wwtRjOIfSxDq/Mu7ZIaFZ9CxRIe6U=
kusionstack.io/kube-api v0.7.4-0.20251013070018-4c09604521e4/go.mod h1:e1jtrQH2LK5fD2nTyfIXG6nYrYbU8VXShRxTRwVPaLk=
kusionstack.io/kube-api v0.7.4-0.20251201074336-61ceab2afe3a h1:hRzUDjPPqBrA3CAiqKur0lHMpBS9p/apsUVTzNf4lMo=
kusionstack.io/kube-api v0.7.4-0.20251201074336-61ceab2afe3a/go.mod h1:e1jtrQH2LK5fD2nTyfIXG6nYrYbU8VXShRxTRwVPaLk=
kusionstack.io/kube-api v0.7.4 h1:9fM+SZtYvuVn5L/DuG7oAC+Z17uSDAeVbiAfjugI3SQ=
kusionstack.io/kube-api v0.7.4/go.mod h1:e1jtrQH2LK5fD2nTyfIXG6nYrYbU8VXShRxTRwVPaLk=
kusionstack.io/kube-utils v0.2.1-0.20251125083928-1134a582b341 h1:dnMtHJvIpU3338WpqGiNN2qXWZFiXaoiuzR9jwhvWpg=
Expand Down
4 changes: 4 additions & 0 deletions pkg/controllers/rolloutrun/executor/do_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"

"github.com/samber/lo"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
rolloutv1alpha1 "kusionstack.io/kube-api/rollout/v1alpha1"

Expand Down Expand Up @@ -56,6 +57,9 @@ func (r *webhookExecutorImpl) Do(ctx *ExecutorContext, hookType rolloutv1alpha1.
// shorten long message
hookResult.Message = utils.Abbreviate(hookResult.Message, 1024)

if hookResult.State == rolloutv1alpha1.WebhookCompleted {
hookResult.FinishTime = ptr.To(metav1.Now())
}
ctx.SetWebhookStatus(rolloutv1alpha1.RolloutWebhookStatus(*hookResult))

if hookResult.State == rolloutv1alpha1.WebhookOnHold &&
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/rolloutrun/webhook/probe/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func DoHTTPProbe(url string, payload *rolloutv1alpha1.RolloutWebhookReview, clie
return probe.Result{
Code: rolloutv1alpha1.WebhookReviewCodeError,
Reason: "HTTPResponseError",
Message: fmt.Sprintf("HTTP probe failed with statuscode: %d, body: %q", res.StatusCode, string(b)),
Message: fmt.Sprintf("HTTP probe failed with statuscode: %d, request: %q, response: %q", res.StatusCode, string(bodyBytes), string(b)),
}
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/controllers/rolloutrun/webhook/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"sync"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/utils/ptr"
Expand Down Expand Up @@ -88,7 +89,8 @@ func newWorker(m *manager, key types.UID, webhook rolloutv1alpha1.RolloutWebhook
}
// init result
w.lastResult = Result{
State: rolloutv1alpha1.WebhookRunning,
State: rolloutv1alpha1.WebhookRunning,
StartTime: ptr.To(metav1.Now()),
CodeReasonMessage: rolloutv1alpha1.CodeReasonMessage{
Code: rolloutv1alpha1.WebhookReviewCodeProcessing,
Reason: "Processing",
Expand Down Expand Up @@ -176,6 +178,9 @@ func (w *worker) doProbe() (keepGoing bool) {
State: rolloutv1alpha1.WebhookRunning,
CodeReasonMessage: probeResult,
}
if w.lastResult.StartTime != nil {
result.StartTime = w.lastResult.StartTime
}

switch result.Code {
case rolloutv1alpha1.WebhookReviewCodeOK:
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/scalerun/executor/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (e *batchExecutor) checkScaledReady(info *workload.Info, scaledFrom, scaled
}

if scaledFrom >= scaledTo {
return info.Status.CurrentReplicas <= info.Status.Replicas
return info.Status.CurrentReplicas <= info.Status.Replicas && info.Status.TerminatingReplicas == 0
} else {
return info.Status.AvailableReplicas >= info.Status.Replicas
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/workload/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ type InfoStatus struct {
UpdatedReadyReplicas int32
// UpdatedAvailableReplicas is the number of service available pods targeted by workload that have the updated template spec.
UpdatedAvailableReplicas int32
// TerminatingReplicas is the number of pods which is marked deletion timestamp
TerminatingReplicas int32
}

func NewInfo(cluster string, gvk schema.GroupVersionKind, obj client.Object, status InfoStatus) *Info {
Expand Down