Skip to content

Commit

Permalink
modify ldm daemonset check
Browse files Browse the repository at this point in the history
Signed-off-by: hellokg21 <[email protected]>
  • Loading branch information
hellokg21 committed Sep 17, 2023
1 parent 54a4c22 commit a33a247
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/install/localdiskmanager/localdiskmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ var ldmDaemonSet = appsv1.DaemonSet{
func SetLDMDaemonSet(clusterInstance *hwameistoriov1alpha1.Cluster) *appsv1.DaemonSet{
ldmDaemonSetToCreate := ldmDaemonSet.DeepCopy()

ldmDaemonSetToCreate.OwnerReferences = append(ldmDaemonSet.OwnerReferences, *metav1.NewControllerRef(clusterInstance, clusterInstance.GroupVersionKind()))
ldmDaemonSetToCreate.OwnerReferences = append(ldmDaemonSetToCreate.OwnerReferences, *metav1.NewControllerRef(clusterInstance, clusterInstance.GroupVersionKind()))
ldmDaemonSetToCreate.Namespace = clusterInstance.Spec.TargetNamespace

newClusterInstance := clusterInstance.DeepCopy()
Expand Down Expand Up @@ -505,9 +505,9 @@ func (m *LocalDiskManagerMaintainer) Ensure() (*hwameistoriov1alpha1.Cluster, er
return newClusterInstance, nil
}

func CheckLDMReallyReady(cli client.Client) bool {
func CheckLDMReallyReady(cli client.Client, clusterInstance *hwameistoriov1alpha1.Cluster) bool {
key := types.NamespacedName{
Namespace: ldmDaemonSet.Namespace,
Namespace: clusterInstance.Spec.TargetNamespace,
Name: ldmDaemonSet.Name,
}
var gottenDS appsv1.DaemonSet
Expand All @@ -529,7 +529,7 @@ func CheckLDMReallyReady(cli client.Client) bool {
}

var podList corev1.PodList
if err := cli.List(context.TODO(), &podList, &client.ListOptions{Namespace: ldmDaemonSet.Namespace}); err != nil {
if err := cli.List(context.TODO(), &podList, &client.ListOptions{Namespace: key.Namespace}); err != nil {
log.Errorf("List pods err: %v", err)
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/install/utils/disk_reserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func CheckComponentsInstalledSuccessfully(cli client.Client, clusterInstance *hw
}
}

if !localdiskmanager.CheckLDMReallyReady(cli) {
if !localdiskmanager.CheckLDMReallyReady(cli, clusterInstance) {
log.Errorf("localDiskManager is not really ready")
return false
}
Expand Down

0 comments on commit a33a247

Please sign in to comment.