Skip to content

Commit afa7389

Browse files
author
玖宇
committed
wip
Signed-off-by: 玖宇 <guotongyu.gty@alibaba-inc.com>
1 parent 3abb1b0 commit afa7389

2 files changed

Lines changed: 0 additions & 92 deletions

File tree

pkg/ddc/thin/health_check.go

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@
1717
package thin
1818

1919
import (
20-
"context"
21-
"fmt"
22-
"reflect"
23-
24-
data "github.com/fluid-cloudnative/fluid/api/v1alpha1"
25-
"github.com/fluid-cloudnative/fluid/pkg/utils"
26-
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"
27-
v1 "k8s.io/api/core/v1"
2820
"k8s.io/client-go/util/retry"
2921
)
3022

@@ -39,86 +31,6 @@ func (t ThinEngine) CheckRuntimeHealthy() (err error) {
3931
return
4032
}
4133

42-
// checkWorkersHealthy check workers number changed
43-
func (t *ThinEngine) checkWorkersHealthy() (err error) {
44-
workerName := t.getWorkerName()
45-
46-
// Check the status of workers
47-
workers, err := kubeclient.GetStatefulSet(t.Client, workerName, t.namespace)
48-
if err != nil {
49-
return err
50-
}
51-
52-
healthy := false
53-
err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
54-
55-
runtime, err := t.getRuntime()
56-
if err != nil {
57-
return err
58-
}
59-
60-
runtimeToUpdate := runtime.DeepCopy()
61-
if workers.Status.ReadyReplicas == 0 && *workers.Spec.Replicas > 0 {
62-
if len(runtimeToUpdate.Status.Conditions) == 0 {
63-
runtimeToUpdate.Status.Conditions = []data.RuntimeCondition{}
64-
}
65-
cond := utils.NewRuntimeCondition(data.RuntimeWorkersReady, "The workers are not ready.",
66-
fmt.Sprintf("The statefulset %s in %s are not ready, the Unavailable number is %d, please fix it.",
67-
workers.Name,
68-
workers.Namespace,
69-
*workers.Spec.Replicas-workers.Status.ReadyReplicas), v1.ConditionFalse)
70-
71-
_, oldCond := utils.GetRuntimeCondition(runtimeToUpdate.Status.Conditions, cond.Type)
72-
73-
if oldCond == nil || oldCond.Type != cond.Type {
74-
runtimeToUpdate.Status.Conditions =
75-
utils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,
76-
cond)
77-
}
78-
79-
runtimeToUpdate.Status.WorkerPhase = data.RuntimePhaseNotReady
80-
81-
t.Log.Error(err, "the workers are not ready")
82-
} else {
83-
healthy = true
84-
cond := utils.NewRuntimeCondition(data.RuntimeWorkersReady, "The workers are ready.",
85-
"The workers are ready", v1.ConditionTrue)
86-
87-
_, oldCond := utils.GetRuntimeCondition(runtimeToUpdate.Status.Conditions, cond.Type)
88-
89-
if oldCond == nil || oldCond.Type != cond.Type {
90-
runtimeToUpdate.Status.Conditions =
91-
utils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,
92-
cond)
93-
}
94-
}
95-
runtimeToUpdate.Status.WorkerNumberReady = workers.Status.ReadyReplicas
96-
runtimeToUpdate.Status.WorkerNumberAvailable = workers.Status.CurrentReplicas
97-
if !reflect.DeepEqual(runtime.Status, runtimeToUpdate.Status) {
98-
updateErr := t.Client.Status().Update(context.TODO(), runtimeToUpdate)
99-
if updateErr != nil {
100-
return updateErr
101-
}
102-
}
103-
104-
return err
105-
})
106-
107-
if err != nil {
108-
t.Log.Error(err, "Failed update runtime")
109-
return err
110-
}
111-
112-
if !healthy {
113-
err = fmt.Errorf("the workers %s in %s are not ready, the unhealthy number %d",
114-
workers.Name,
115-
workers.Namespace,
116-
*workers.Spec.Replicas-workers.Status.ReadyReplicas)
117-
}
118-
119-
return err
120-
}
121-
12234
// checkFuseHealthy check fuses number changed
12335
func (t *ThinEngine) checkFuseHealthy() error {
12436
return retry.RetryOnConflict(retry.DefaultBackoff, func() (err error) {

pkg/ddc/thin/util.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ func (t *ThinEngine) getFuseName() (dsName string) {
6565
return t.name + "-fuse"
6666
}
6767

68-
func (t *ThinEngine) getWorkerName() (dsName string) {
69-
return t.name + "-worker"
70-
}
71-
7268
func (t *ThinEngine) getTargetPath() (targetPath string) {
7369
mountRoot := getMountRoot()
7470
t.Log.Info("mountRoot", "path", mountRoot)

0 commit comments

Comments
 (0)