improve some log information
Signed-off-by: yunbo <yunbo10124scut@gmail.com>
This commit is contained in:
parent
68859205f7
commit
bfad7f22a4
|
@ -579,6 +579,8 @@ const (
|
|||
FinalisingStepReleaseWorkloadControl FinalisingStepType = "ReleaseWorkloadControl"
|
||||
// All needed work done
|
||||
FinalisingStepTypeEnd FinalisingStepType = "END"
|
||||
// Only for debugging use
|
||||
FinalisingStepWaitEndless FinalisingStepType = "WaitEndless"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
|
|
|
@ -166,8 +166,6 @@ rules:
|
|||
resources:
|
||||
- horizontalpodautoscalers
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
|
|
|
@ -148,7 +148,7 @@ type BatchReleaseReconciler struct {
|
|||
// +kubebuilder:rbac:groups=apps.kruise.io,resources=statefulsets/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=apps.kruise.io,resources=daemonsets,verbs=get;list;watch;update;patch
|
||||
// +kubebuilder:rbac:groups=apps.kruise.io,resources=daemonsets/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;update;patch
|
||||
|
||||
// Reconcile reads that state of the cluster for a Rollout object and makes changes based on the state read
|
||||
// and what is in the Rollout.Spec
|
||||
|
|
|
@ -80,7 +80,6 @@ func (rc *realController) ListOwnedPods() ([]*corev1.Pod, error) {
|
|||
}
|
||||
|
||||
func (rc *realController) Initialize(release *v1beta1.BatchRelease) error {
|
||||
klog.Info("Initialize cloneset controller")
|
||||
if rc.object == nil || control.IsControlledByBatchRelease(release, rc.object) {
|
||||
return nil
|
||||
}
|
||||
|
@ -120,10 +119,10 @@ func (rc *realController) UpgradeBatch(ctx *batchcontext.BatchContext) error {
|
|||
desired, _ := intstr.GetScaledValueFromIntOrPercent(&ctx.DesiredSurge, int(ctx.Replicas), true)
|
||||
current, _ := intstr.GetScaledValueFromIntOrPercent(&ctx.CurrentSurge, int(ctx.Replicas), true)
|
||||
if current >= desired {
|
||||
klog.Infof("No need to upgrade batch for cloneset %v: because current %d >= desired %d", klog.KObj(rc.object), current, desired)
|
||||
klog.InfoS("No need to upgrade batch, because current >= desired", "cloneset", klog.KObj(rc.object), "current", current, "desired", desired)
|
||||
return nil
|
||||
} else {
|
||||
klog.Infof("Will update batch for cloneset %v: current %d < desired %d", klog.KObj(rc.object), current, desired)
|
||||
klog.InfoS("Will update batch for cloneset, because current < desired", "cloneset", klog.KObj(rc.object), "current", current, "desired", desired)
|
||||
}
|
||||
patchData := patch.NewClonesetPatch()
|
||||
// avoid interference from partition
|
||||
|
@ -168,7 +167,7 @@ func (rc *realController) Finalize(release *v1beta1.BatchRelease) error {
|
|||
return errors.NewRetryError(fmt.Errorf("cloneset %v finalize not done, readyReplicas %d != updatedReadyReplicas %d, current policy %s",
|
||||
klog.KObj(rc.object), rc.object.Status.ReadyReplicas, rc.object.Status.UpdatedReadyReplicas, release.Spec.ReleasePlan.FinalizingPolicy))
|
||||
}
|
||||
klog.InfoS("Finalize: cloneset bluegreen release: all pods updated and ready")
|
||||
klog.InfoS("Finalize: cloneset bluegreen release: all pods updated and ready", "cloneset", klog.KObj(rc.object))
|
||||
|
||||
// restore the hpa
|
||||
return hpa.RestoreHPA(rc.client, rc.object)
|
||||
|
|
|
@ -171,14 +171,14 @@ func (rc *realController) Finalize(release *v1beta1.BatchRelease) error {
|
|||
if err := rc.client.Patch(context.TODO(), d, patchData); err != nil {
|
||||
return err
|
||||
}
|
||||
klog.InfoS("Finalize: deployment bluegreen release: wait all pods updated and ready", "cloneset", klog.KObj(rc.object))
|
||||
klog.InfoS("Finalize: deployment bluegreen release: wait all pods updated and ready", "Deployment", klog.KObj(rc.object))
|
||||
}
|
||||
|
||||
// wait all pods updated and ready
|
||||
if err := waitAllUpdatedAndReady(d.(*apps.Deployment)); err != nil {
|
||||
return errors.NewRetryError(err)
|
||||
}
|
||||
klog.InfoS("Finalize: deployment is ready to resume, restore the original setting", "deployment", klog.KObj(rc.object))
|
||||
klog.InfoS("Finalize: All pods updated and ready, then restore hpa", "Deployment", klog.KObj(rc.object))
|
||||
|
||||
// restore hpa
|
||||
return hpa.RestoreHPA(rc.client, rc.object)
|
||||
|
|
|
@ -62,7 +62,6 @@ func (m *blueGreenReleaseManager) runCanary(c *RolloutContext) error {
|
|||
}
|
||||
|
||||
if m.doCanaryJump(c) {
|
||||
klog.Infof("rollout(%s/%s) canary step jumped", c.Rollout.Namespace, c.Rollout.Name)
|
||||
return nil
|
||||
}
|
||||
// When the first batch is trafficRouting rolling and the next steps are rolling release,
|
||||
|
@ -323,6 +322,9 @@ func (m *blueGreenReleaseManager) doCanaryFinalising(c *RolloutContext) (bool, e
|
|||
// route all traffic to new version
|
||||
case v1beta1.FinalisingStepRouteTrafficToNew:
|
||||
retry, err = m.trafficRoutingManager.RouteAllTrafficToNewVersion(tr)
|
||||
// dangerous, wait endlessly, only for debugging use
|
||||
case v1beta1.FinalisingStepWaitEndless:
|
||||
retry, err = true, fmt.Errorf("only for debugging, just wait endlessly")
|
||||
default:
|
||||
nextStep = nextBlueGreenTask(c.FinalizeReason, "")
|
||||
klog.Warningf("unexpected finalising step, current step(%s), start from the first step(%s)", blueGreenStatus.FinalisingStep, nextStep)
|
||||
|
@ -453,10 +455,9 @@ func nextBlueGreenTask(reason string, currentTask v1beta1.FinalisingStepType) v1
|
|||
default: // others: disabled/deleting rollout
|
||||
taskSequence = []v1beta1.FinalisingStepType{
|
||||
v1beta1.FinalisingStepRestoreStableService,
|
||||
v1beta1.FinalisingStepResumeWorkload, // scale up new, scale down old
|
||||
v1beta1.FinalisingStepRouteTrafficToStable,
|
||||
|
||||
v1beta1.FinalisingStepRemoveCanaryService,
|
||||
v1beta1.FinalisingStepResumeWorkload, // scale up new, scale down old
|
||||
v1beta1.FinalisingStepReleaseWorkloadControl,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ func (m *canaryReleaseManager) runCanary(c *RolloutContext) error {
|
|||
}
|
||||
|
||||
if m.doCanaryJump(c) {
|
||||
klog.Infof("rollout(%s/%s) canary step jumped", c.Rollout.Namespace, c.Rollout.Name)
|
||||
return nil
|
||||
}
|
||||
// When the first batch is trafficRouting rolling and the next steps are rolling release,
|
||||
|
|
Loading…
Reference in New Issue