From bb5eade6805404ccfff3e36512400431d17fcb13 Mon Sep 17 00:00:00 2001 From: Leon Date: Mon, 23 Oct 2023 15:44:56 +0800 Subject: [PATCH] remove component restart --- controllers/apps/components/utils.go | 15 --------------- .../apps/transformer_component_workload.go | 10 ---------- 2 files changed, 25 deletions(-) diff --git a/controllers/apps/components/utils.go b/controllers/apps/components/utils.go index 8a967920e5d..76cc3ef1d8b 100644 --- a/controllers/apps/components/utils.go +++ b/controllers/apps/components/utils.go @@ -75,21 +75,6 @@ func ListPodOwnedByComponent(ctx context.Context, cli client.Client, namespace s return ListObjWithLabelsInNamespace(ctx, cli, generics.PodSignature, namespace, labels) } -// RestartPod restarts a Pod through updating the pod's annotation -func RestartPod(podTemplate *corev1.PodTemplateSpec) error { - if podTemplate.Annotations == nil { - podTemplate.Annotations = map[string]string{} - } - - startTimestamp := time.Now() // TODO(impl): opsRes.OpsRequest.Status.StartTimestamp - restartTimestamp := podTemplate.Annotations[constant.RestartAnnotationKey] - // if res, _ := time.Parse(time.RFC3339, restartTimestamp); startTimestamp.After(res) { - if res, _ := time.Parse(time.RFC3339, restartTimestamp); startTimestamp.Before(res) { - podTemplate.Annotations[constant.RestartAnnotationKey] = startTimestamp.Format(time.RFC3339) - } - return nil -} - // mergeAnnotations keeps the original annotations. // if annotations exist and are replaced, the Deployment/StatefulSet will be updated. func mergeAnnotations(originalAnnotations map[string]string, targetAnnotations *map[string]string) { diff --git a/controllers/apps/transformer_component_workload.go b/controllers/apps/transformer_component_workload.go index ff6376ad06a..dc7b0df48ed 100644 --- a/controllers/apps/transformer_component_workload.go +++ b/controllers/apps/transformer_component_workload.go @@ -153,11 +153,6 @@ func (t *ComponentWorkloadTransformer) handleWorkloadUpdate(reqCtx intctrlutil.R cluster *appsv1alpha1.Cluster, synthesizeComp *component.SynthesizedComponent, obj, rsm *workloads.ReplicatedStateMachine) error { cwo := newComponentWorkloadOps(reqCtx, t.Client, cluster, synthesizeComp, obj, rsm, dag) - // handle rsm workload restart - if err := cwo.restart(); err != nil { - return err - } - // handle rsm expand volume if err := cwo.expandVolume(); err != nil { return err @@ -295,11 +290,6 @@ func copyAndMerge(oldObj, newObj client.Object, cluster *appsv1alpha1.Cluster) c } } -// restart handles rsm workload restart by patch pod template annotation -func (r *componentWorkloadOps) restart() error { - return components.RestartPod(&r.runningRSM.Spec.Template) -} - // expandVolume handles rsm workload expand volume func (r *componentWorkloadOps) expandVolume() error { for _, vct := range r.runningRSM.Spec.VolumeClaimTemplates {