@@ -337,9 +337,7 @@ func desiredServiceAccount(cluster *rayv1.RayCluster) *corev1ac.ServiceAccountAp
337337 `{"kind":"OAuthRedirectReference","apiVersion":"v1",` +
338338 `"reference":{"kind":"Route","name":"` + dashboardNameFromCluster (cluster ) + `"}}` ,
339339 }).
340- WithOwnerReferences (
341- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
342- )
340+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
343341}
344342
345343func dashboardNameFromCluster (cluster * rayv1.RayCluster ) string {
@@ -361,9 +359,7 @@ func desiredClusterRoute(cluster *rayv1.RayCluster) *routev1ac.RouteApplyConfigu
361359 WithTermination (routev1 .TLSTerminationReencrypt ),
362360 ),
363361 ).
364- WithOwnerReferences (
365- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
366- )
362+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
367363}
368364
369365func oauthServiceNameFromCluster (cluster * rayv1.RayCluster ) string {
@@ -389,9 +385,7 @@ func desiredOAuthService(cluster *rayv1.RayCluster) *corev1ac.ServiceApplyConfig
389385 ).
390386 WithSelector (map [string ]string {"ray.io/cluster" : cluster .Name , "ray.io/node-type" : "head" }),
391387 ).
392- WithOwnerReferences (
393- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
394- )
388+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
395389}
396390
397391func oauthSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
@@ -408,9 +402,7 @@ func desiredOAuthSecret(cluster *rayv1.RayCluster, cookieSalt string) *corev1ac.
408402 return corev1ac .Secret (oauthSecretNameFromCluster (cluster ), cluster .Namespace ).
409403 WithLabels (map [string ]string {RayClusterNameLabel : cluster .Name }).
410404 WithStringData (map [string ]string {"cookie_secret" : cookieSecret }).
411- WithOwnerReferences (
412- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
413- )
405+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
414406}
415407
416408func caSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
@@ -424,12 +416,7 @@ func desiredCASecret(cluster *rayv1.RayCluster, key, cert []byte) *corev1ac.Secr
424416 CAPrivateKeyKey : key ,
425417 CACertKey : cert ,
426418 }).
427- WithOwnerReferences (metav1ac .OwnerReference ().
428- WithUID (cluster .UID ).
429- WithName (cluster .Name ).
430- WithKind (cluster .Kind ).
431- WithAPIVersion (cluster .APIVersion ).
432- WithController (true ))
419+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
433420}
434421
435422func generateCACertificate () ([]byte , []byte , error ) {
@@ -487,9 +474,7 @@ func desiredWorkersNetworkPolicy(cluster *rayv1.RayCluster) *networkingv1ac.Netw
487474 ),
488475 ),
489476 ).
490- WithOwnerReferences (
491- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
492- )
477+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
493478}
494479
495480func desiredHeadNetworkPolicy (cluster * rayv1.RayCluster , cfg * config.KubeRayConfiguration , kubeRayNamespaces []string ) * networkingv1ac.NetworkPolicyApplyConfiguration {
@@ -545,9 +530,7 @@ func desiredHeadNetworkPolicy(cluster *rayv1.RayCluster, cfg *config.KubeRayConf
545530 ),
546531 ),
547532 ).
548- WithOwnerReferences (
549- metav1ac .OwnerReference ().WithUID (cluster .UID ).WithName (cluster .Name ).WithKind (cluster .Kind ).WithAPIVersion (cluster .APIVersion ).WithController (true ),
550- )
533+ WithOwnerReferences (ownerRefForRayCluster (cluster ))
551534}
552535
553536func (r * RayClusterReconciler ) deleteHeadPodIfMissingImagePullSecrets (ctx context.Context , cluster * rayv1.RayCluster ) error {
0 commit comments