Skip to content

Commit

Permalink
Check duplicates services explicitly (ray-project#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffwan authored Oct 16, 2021
1 parent d5272fb commit 22851bb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ray-operator/controllers/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,20 @@ func (r *RayClusterReconciler) reconcileServices(instance *rayiov1alpha1.RayClus
return err
}

if headServices.Items != nil && len(headServices.Items) == 1 {
r.Log.Info("reconcileServices ", "head service found", headServices.Items[0].Name)
// TODO: compare diff and reconcile the object
// For example. ServiceType might be changed or port might be modified
return nil
if headServices.Items != nil {
if len(headServices.Items) == 1 {
r.Log.Info("reconcileServices ", "head service found", headServices.Items[0].Name)
// TODO: compare diff and reconcile the object
// For example. ServiceType might be changed or port might be modified
return nil
}

// This should never happen.
// We add the protection here just in case controller has race issue or user manually create service with same label.
if len(headServices.Items) > 1 {
r.Log.Info("reconcileServices ", "Duplicates head service found", len(headServices.Items))
return nil
}
}

// Create head service if there's no existing one in the cluster.
Expand Down

0 comments on commit 22851bb

Please sign in to comment.