mirror of
https://github.com/vale981/ray
synced 2025-03-05 10:01:43 -05:00
Set RayCluster as service owner (#7621)
This commit is contained in:
parent
0d0a41f598
commit
c78b52b5b2
1 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"strings"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -125,6 +126,15 @@ func (r *RayClusterReconciler) Reconcile(request reconcile.Request) (reconcile.R
|
|||
podName := elem.(string)
|
||||
svcConf := common.DefaultServiceConfig(*instance, podName)
|
||||
rayPodSvc := common.ServiceForPod(svcConf)
|
||||
blockOwnerDeletion := true
|
||||
ownerReference := metav1.OwnerReference{
|
||||
APIVersion: instance.APIVersion,
|
||||
Kind: instance.Kind,
|
||||
Name: instance.Name,
|
||||
UID: instance.UID,
|
||||
BlockOwnerDeletion: &blockOwnerDeletion,
|
||||
}
|
||||
rayPodSvc.OwnerReferences = append(rayPodSvc.OwnerReferences, ownerReference)
|
||||
if errSvc := r.Create(context.TODO(), rayPodSvc); errSvc != nil {
|
||||
if errors.IsAlreadyExists(errSvc) {
|
||||
log.Info("Pod service already exist,no need to create")
|
||||
|
|
Loading…
Add table
Reference in a new issue