@@ -304,7 +304,7 @@ func isMTLSEnabled(cfg *config.KubeRayConfiguration) bool {
304304}
305305
306306func crbNameFromCluster (cluster * rayv1.RayCluster ) string {
307- return cluster .Name + "-" + cluster .Namespace + "-auth" // NOTE: potential naming conflicts ie {name: foo, ns: bar-baz} and {name: foo-bar, ns: baz}
307+ return getUniqueName ( cluster .Name + "-" + cluster .Namespace + "-auth" )
308308}
309309
310310func desiredOAuthClusterRoleBinding (cluster * rayv1.RayCluster ) * rbacv1ac.ClusterRoleBindingApplyConfiguration {
@@ -326,7 +326,7 @@ func desiredOAuthClusterRoleBinding(cluster *rayv1.RayCluster) *rbacv1ac.Cluster
326326}
327327
328328func oauthServiceAccountNameFromCluster (cluster * rayv1.RayCluster ) string {
329- return cluster .Name + "-oauth-proxy"
329+ return getUniqueName ( cluster .Name + "-oauth-proxy" )
330330}
331331
332332func desiredServiceAccount (cluster * rayv1.RayCluster ) * corev1ac.ServiceAccountApplyConfiguration {
@@ -341,11 +341,11 @@ func desiredServiceAccount(cluster *rayv1.RayCluster) *corev1ac.ServiceAccountAp
341341}
342342
343343func dashboardNameFromCluster (cluster * rayv1.RayCluster ) string {
344- return "ray-dashboard-" + cluster .Name
344+ return getUniqueName ( "ray-dashboard-" + cluster .Name )
345345}
346346
347347func rayClientNameFromCluster (cluster * rayv1.RayCluster ) string {
348- return "rayclient-" + cluster .Name
348+ return getUniqueName ( "rayclient-" + cluster .Name )
349349}
350350
351351func desiredClusterRoute (cluster * rayv1.RayCluster ) * routev1ac.RouteApplyConfiguration {
@@ -363,11 +363,11 @@ func desiredClusterRoute(cluster *rayv1.RayCluster) *routev1ac.RouteApplyConfigu
363363}
364364
365365func oauthServiceNameFromCluster (cluster * rayv1.RayCluster ) string {
366- return cluster .Name + "-oauth"
366+ return getUniqueName ( cluster .Name + "-oauth" )
367367}
368368
369369func oauthServiceTLSSecretName (cluster * rayv1.RayCluster ) string {
370- return cluster .Name + "-proxy-tls-secret"
370+ return getUniqueName ( cluster .Name + "-proxy-tls-secret" )
371371}
372372
373373func desiredOAuthService (cluster * rayv1.RayCluster ) * corev1ac.ServiceApplyConfiguration {
@@ -389,7 +389,7 @@ func desiredOAuthService(cluster *rayv1.RayCluster) *corev1ac.ServiceApplyConfig
389389}
390390
391391func oauthSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
392- return cluster .Name + "-oauth-config"
392+ return getUniqueName ( cluster .Name + "-oauth-config" )
393393}
394394
395395// desiredOAuthSecret defines the desired OAuth secret object
@@ -406,7 +406,7 @@ func desiredOAuthSecret(cluster *rayv1.RayCluster, cookieSalt string) *corev1ac.
406406}
407407
408408func caSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
409- return "ca-secret-" + cluster .Name
409+ return getUniqueName ( "ca-secret-" + cluster .Name )
410410}
411411
412412func desiredCASecret (cluster * rayv1.RayCluster , key , cert []byte ) * corev1ac.SecretApplyConfiguration {
@@ -463,7 +463,9 @@ func generateCACertificate() ([]byte, []byte, error) {
463463}
464464
465465func desiredWorkersNetworkPolicy (cluster * rayv1.RayCluster ) * networkingv1ac.NetworkPolicyApplyConfiguration {
466- return networkingv1ac .NetworkPolicy (cluster .Name + "-workers" , cluster .Namespace ).
466+ return networkingv1ac .NetworkPolicy (
467+ getUniqueName (cluster .Name + "-workers" ), cluster .Namespace ,
468+ ).
467469 WithLabels (map [string ]string {RayClusterNameLabel : cluster .Name }).
468470 WithSpec (networkingv1ac .NetworkPolicySpec ().
469471 WithPodSelector (metav1ac .LabelSelector ().WithMatchLabels (map [string ]string {"ray.io/cluster" : cluster .Name , "ray.io/node-type" : "worker" })).
@@ -484,7 +486,7 @@ func desiredHeadNetworkPolicy(cluster *rayv1.RayCluster, cfg *config.KubeRayConf
484486 if ptr .Deref (cfg .MTLSEnabled , true ) {
485487 allSecuredPorts = append (allSecuredPorts , networkingv1ac .NetworkPolicyPort ().WithProtocol (corev1 .ProtocolTCP ).WithPort (intstr .FromInt (10001 )))
486488 }
487- return networkingv1ac .NetworkPolicy (cluster .Name + "-head" , cluster .Namespace ).
489+ return networkingv1ac .NetworkPolicy (getUniqueName ( cluster .Name + "-head" ) , cluster .Namespace ).
488490 WithLabels (map [string ]string {RayClusterNameLabel : cluster .Name }).
489491 WithSpec (networkingv1ac .NetworkPolicySpec ().
490492 WithPodSelector (metav1ac .LabelSelector ().WithMatchLabels (map [string ]string {"ray.io/cluster" : cluster .Name , "ray.io/node-type" : "head" })).
0 commit comments