Skip to content

Commit

Permalink
remove component restart
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-inf committed Oct 23, 2023
1 parent 11f9c10 commit bb5eade
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
15 changes: 0 additions & 15 deletions controllers/apps/components/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 0 additions & 10 deletions controllers/apps/transformer_component_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bb5eade

Please sign in to comment.