Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 committed Apr 23, 2024
1 parent 82ba856 commit 649b4fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controllers/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
logger.Error(err, "Failed to update NetworkPolicy")
}

_, err = r.kubeClient.NetworkingV1().NetworkPolicies(cluster.Namespace).Apply(ctx, desiredWorkerNetworkPolicy(cluster), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
_, err = r.kubeClient.NetworkingV1().NetworkPolicies(cluster.Namespace).Apply(ctx, desiredWorkersNetworkPolicy(cluster), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
if err != nil {
logger.Error(err, "Failed to update NetworkPolicy")
}
Expand Down Expand Up @@ -464,9 +464,9 @@ func generateCACertificate() ([]byte, []byte, error) {

return privateKeyPem, certPem, nil
}
func desiredWorkerNetworkPolicy(cluster *rayv1.RayCluster) *networkingv1ac.NetworkPolicyApplyConfiguration {
func desiredWorkersNetworkPolicy(cluster *rayv1.RayCluster) *networkingv1ac.NetworkPolicyApplyConfiguration {
return networkingv1ac.NetworkPolicy(cluster.Name+"-worker", cluster.Namespace).
WithLabels(map[string]string{"ray.io/cluster": cluster.Name}).
WithLabels(map[string]string{"ray.io/cluster-name": cluster.Name}).
WithSpec(networkingv1ac.NetworkPolicySpec().
WithPodSelector(metav1ac.LabelSelector().WithMatchLabels(map[string]string{"ray.io/cluster": cluster.Name, "ray.io/node-type": "worker"})).
WithIngress(
Expand All @@ -488,7 +488,7 @@ func desiredNetworkPolicy(cluster *rayv1.RayCluster, cfg *config.KubeRayConfigur
allSecuredPorts = append(allSecuredPorts, networkingv1ac.NetworkPolicyPort().WithProtocol(corev1.ProtocolTCP).WithPort(intstr.FromInt(10001)))
}
return networkingv1ac.NetworkPolicy(cluster.Name+"-head", cluster.Namespace).
WithLabels(map[string]string{"ray.io/cluster": cluster.Name}).
WithLabels(map[string]string{"ray.io/cluster-name": cluster.Name}).
WithSpec(networkingv1ac.NetworkPolicySpec().
WithPodSelector(metav1ac.LabelSelector().WithMatchLabels(map[string]string{"ray.io/cluster": cluster.Name, "ray.io/node-type": "head"})).
WithIngress(
Expand Down

0 comments on commit 649b4fa

Please sign in to comment.