@@ -86,8 +86,9 @@ const (
86
86
)
87
87
88
88
var (
89
- deletePolicy = metav1 .DeletePropagationForeground
90
- deleteOptions = client.DeleteOptions {PropagationPolicy : & deletePolicy }
89
+ deletePolicy = metav1 .DeletePropagationForeground
90
+ deleteOptions = client.DeleteOptions {PropagationPolicy : & deletePolicy }
91
+ defaultHashLength = 8
91
92
)
92
93
93
94
// +kubebuilder:rbac:groups=ray.io,resources=rayclusters,verbs=get;list;watch;create;update;patch;delete
@@ -304,7 +305,7 @@ func isMTLSEnabled(cfg *config.KubeRayConfiguration) bool {
304
305
}
305
306
306
307
func 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}
308
+ return cluster .Name + "-" + cluster .Namespace + "-auth-" + ControllerSpecificHash ( cluster . Name , defaultHashLength ) // NOTE: potential naming conflicts ie {name: foo, ns: bar-baz} and {name: foo-bar, ns: baz}
308
309
}
309
310
310
311
func desiredOAuthClusterRoleBinding (cluster * rayv1.RayCluster ) * rbacv1ac.ClusterRoleBindingApplyConfiguration {
@@ -326,7 +327,7 @@ func desiredOAuthClusterRoleBinding(cluster *rayv1.RayCluster) *rbacv1ac.Cluster
326
327
}
327
328
328
329
func oauthServiceAccountNameFromCluster (cluster * rayv1.RayCluster ) string {
329
- return cluster .Name + "-oauth-proxy"
330
+ return cluster .Name + "-oauth-proxy-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
330
331
}
331
332
332
333
func desiredServiceAccount (cluster * rayv1.RayCluster ) * corev1ac.ServiceAccountApplyConfiguration {
@@ -343,11 +344,11 @@ func desiredServiceAccount(cluster *rayv1.RayCluster) *corev1ac.ServiceAccountAp
343
344
}
344
345
345
346
func dashboardNameFromCluster (cluster * rayv1.RayCluster ) string {
346
- return "ray-dashboard-" + cluster .Name
347
+ return "ray-dashboard-" + cluster .Name + "-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
347
348
}
348
349
349
350
func rayClientNameFromCluster (cluster * rayv1.RayCluster ) string {
350
- return "rayclient-" + cluster .Name
351
+ return "rayclient-" + cluster .Name + "-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
351
352
}
352
353
353
354
func desiredClusterRoute (cluster * rayv1.RayCluster ) * routev1ac.RouteApplyConfiguration {
@@ -367,11 +368,11 @@ func desiredClusterRoute(cluster *rayv1.RayCluster) *routev1ac.RouteApplyConfigu
367
368
}
368
369
369
370
func oauthServiceNameFromCluster (cluster * rayv1.RayCluster ) string {
370
- return cluster .Name + "-oauth"
371
+ return cluster .Name + "-oauth-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
371
372
}
372
373
373
374
func oauthServiceTLSSecretName (cluster * rayv1.RayCluster ) string {
374
- return cluster .Name + "-proxy-tls-secret"
375
+ return cluster .Name + "-proxy-tls-secret-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
375
376
}
376
377
377
378
func desiredOAuthService (cluster * rayv1.RayCluster ) * corev1ac.ServiceApplyConfiguration {
@@ -395,7 +396,7 @@ func desiredOAuthService(cluster *rayv1.RayCluster) *corev1ac.ServiceApplyConfig
395
396
}
396
397
397
398
func oauthSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
398
- return cluster .Name + "-oauth-config"
399
+ return cluster .Name + "-oauth-config-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
399
400
}
400
401
401
402
// desiredOAuthSecret defines the desired OAuth secret object
@@ -414,7 +415,7 @@ func desiredOAuthSecret(cluster *rayv1.RayCluster, cookieSalt string) *corev1ac.
414
415
}
415
416
416
417
func caSecretNameFromCluster (cluster * rayv1.RayCluster ) string {
417
- return "ca-secret-" + cluster .Name
418
+ return "ca-secret-" + cluster .Name + "-" + ControllerSpecificHash ( cluster . Name , defaultHashLength )
418
419
}
419
420
420
421
func desiredCASecret (cluster * rayv1.RayCluster , key , cert []byte ) * corev1ac.SecretApplyConfiguration {
@@ -476,7 +477,9 @@ func generateCACertificate() ([]byte, []byte, error) {
476
477
}
477
478
478
479
func desiredWorkersNetworkPolicy (cluster * rayv1.RayCluster ) * networkingv1ac.NetworkPolicyApplyConfiguration {
479
- return networkingv1ac .NetworkPolicy (cluster .Name + "-workers" , cluster .Namespace ).
480
+ return networkingv1ac .NetworkPolicy (
481
+ cluster .Name + "-workers-" + ControllerSpecificHash (cluster .Name , defaultHashLength ), cluster .Namespace ,
482
+ ).
480
483
WithLabels (map [string ]string {RayClusterNameLabel : cluster .Name }).
481
484
WithSpec (networkingv1ac .NetworkPolicySpec ().
482
485
WithPodSelector (metav1ac .LabelSelector ().WithMatchLabels (map [string ]string {"ray.io/cluster" : cluster .Name , "ray.io/node-type" : "worker" })).
@@ -499,7 +502,7 @@ func desiredHeadNetworkPolicy(cluster *rayv1.RayCluster, cfg *config.KubeRayConf
499
502
if ptr .Deref (cfg .MTLSEnabled , true ) {
500
503
allSecuredPorts = append (allSecuredPorts , networkingv1ac .NetworkPolicyPort ().WithProtocol (corev1 .ProtocolTCP ).WithPort (intstr .FromInt (10001 )))
501
504
}
502
- return networkingv1ac .NetworkPolicy (cluster .Name + "-head" , cluster .Namespace ).
505
+ return networkingv1ac .NetworkPolicy (cluster .Name + "-head-" + ControllerSpecificHash ( cluster . Name , defaultHashLength ) , cluster .Namespace ).
503
506
WithLabels (map [string ]string {RayClusterNameLabel : cluster .Name }).
504
507
WithSpec (networkingv1ac .NetworkPolicySpec ().
505
508
WithPodSelector (metav1ac .LabelSelector ().WithMatchLabels (map [string ]string {"ray.io/cluster" : cluster .Name , "ray.io/node-type" : "head" })).
0 commit comments