Files
1df0651f91 [Feature] Add NetworkIsolation support to RayClusters (#4638)
* [Feature] Add NetworkIsolation support to RayClusters

Co-authored-by: Pat O'Connor <[email protected]>
Co-authored-by: Bryan Keane <[email protected]>

* add feature gate reg to integration tests + removed redundant if err

Signed-off-by: Pat O'Connor <[email protected]>

* separate function for head and base ingress rules

Signed-off-by: Pat O'Connor <[email protected]>

* logger updates as per review

Signed-off-by: Pat O'Connor <[email protected]>

* adjust DNS egress rule to allow all port 53 egress

Signed-off-by: Pat O'Connor <[email protected]>

* resolve helm chart CI failure

Signed-off-by: Pat O'Connor <[email protected]>

* restrict KubeRay rule via NamespaceSelector

Signed-off-by: Pat O'Connor <[email protected]>

* check if update is necessary on NP via DeepEqual

Signed-off-by: Pat O'Connor <[email protected]>

* prevent same-name NP mod + add namespace fallback to default

Signed-off-by: Pat O'Connor <[email protected]>

* add missing rayStartParams ports to custom ports example

Signed-off-by: Pat O'Connor <[email protected]>

* emit warning when existing NP conflicts with new one via name + fix test

Signed-off-by: Pat O'Connor <[email protected]>

* remove redundant samples + add new samples

Signed-off-by: Pat O'Connor <[email protected]>

* remove permissive pod selector rule + test updates

Signed-off-by: Pat O'Connor <[email protected]>

* prop labels to jobsubmitter for networkpolicy rule

Signed-off-by: Pat O'Connor <[email protected]>

* Add opt-in ALLOW_ALL_RAYJOB_SUBMITTERS env var for broad submitter ingress on standalone RayClusters

Signed-off-by: Pat O'Connor <[email protected]>

* updated API and config to fix CI failures

Signed-off-by: Pat O'Connor <[email protected]>

* Moved label prop to getSummitterTemplate + review changes

Signed-off-by: Pat O'Connor <[email protected]>

* Review feedback: failed deletion event + reconcile on dupe + nits

Signed-off-by: Pat O'Connor <[email protected]>

* use rayStartParams for ports + review nits

Signed-off-by: Pat O'Connor <[email protected]>

* test fix + convert constants to CamelCase

Signed-off-by: Pat O'Connor <[email protected]>

* helm updates + check if RayCluster is externally managed

Signed-off-by: Pat O'Connor <[email protected]>

* API updates per review + autoscaling egress rule

Signed-off-by: Pat O'Connor <[email protected]>

* Use standard lib for CIDR + use logConstructor consistently

Signed-off-by: Pat O'Connor <[email protected]>

* Use EndpointSlice IPs for API server egress rule

Signed-off-by: Pat O'Connor <[email protected]>

* Deduplicates ports + peers across EndpointSlices in egress rules

Signed-off-by: Pat O'Connor <[email protected]>

* Remove operator namespace fallback and prop error if namespace not found

Signed-off-by: Pat O'Connor <[email protected]>

* Remove patch verb for networkpolicies

Signed-off-by: Pat O'Connor <[email protected]>

* Remove client port rule for operator

Signed-off-by: Pat O'Connor <[email protected]>

* Add reconcileConcurrency and GenerationChangedPredicate to NetworkPolicy controller setup

Signed-off-by: Pat O'Connor <[email protected]>

* solve 3 points, close to merge

Signed-off-by: Future-Outlier <[email protected]>

* helper

Signed-off-by: Future-Outlier <[email protected]>

* update

Signed-off-by: Future-Outlier <[email protected]>

* CI failure fixes after DNS logic removal

Signed-off-by: Pat O'Connor <[email protected]>

* Revert "helper"

This reverts commit 26c4053ae5775517f60a01cc4fb9457265d832c4.

* Skip networkpolicy integration test when missing namespace

Signed-off-by: Pat O'Connor <[email protected]>

* Normalize defaulted NetworkPolicy ports before comparing

Signed-off-by: Pat O'Connor <[email protected]>

* Drop network policy integration tests pending followup e2e

Signed-off-by: Pat O'Connor <[email protected]>

* Remove operator namespace ingress rule

Signed-off-by: Pat O'Connor <[email protected]>

* networkpolicy: separate head/worker custom rules in API Replace the flat ingressRules/egressRules on NetworkIsolationConfig with per-role head/worker sub-structs.Since the API has not shipped yet, this avoids locking in a shared-only design that would require a backward-compatible migration later. Head and workers have fundamentally different security profiles — head needs external access (dashboard, submitter, Prometheus) while workers typically need outbound access (S3, model registries). A shared-only API forces users to over-permit workers just to allow access to the head. New API shape:   networkIsolation:     mode: DenyAll     head:       ingressRules: [...]       egressRules: [...]     worker:       ingressRules: [...]       egressRules: [...]

Co-authored-by: Cursor <[email protected]>

* NetworkIsolation API change cleanup

Signed-off-by: Pat O'Connor <[email protected]>

* Unit tests to ensure custom policies don't leak between head and worker

Signed-off-by: Pat O'Connor <[email protected]>

* Sample comment indendation and removal of operator rule from API docs

Signed-off-by: Pat O'Connor <[email protected]>

* Indent update to pass linter

Signed-off-by: Pat O'Connor <[email protected]>

* Additional review nits - comments etc

Signed-off-by: Pat O'Connor <[email protected]>

* Remove redundant comments in controller code

Signed-off-by: Pat O'Connor <[email protected]>

---------

Signed-off-by: Pat O'Connor <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Co-authored-by: Laura Fitzgerald <[email protected]>
Co-authored-by: Bryan Keane <[email protected]>
Co-authored-by: Future-Outlier <[email protected]>
Co-authored-by: Cursor <[email protected]>
2026-06-23 10:03:32 -04:00

95 lines
4.5 KiB
Go

// Code generated by applyconfiguration-gen. DO NOT EDIT.
package applyconfiguration
import (
v1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
internal "github.com/ray-project/kuberay/ray-operator/pkg/client/applyconfiguration/internal"
rayv1 "github.com/ray-project/kuberay/ray-operator/pkg/client/applyconfiguration/ray/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
)
// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no
// apply configuration type exists for the given GroupVersionKind.
func ForKind(kind schema.GroupVersionKind) interface{} {
switch kind {
// Group=ray.io, Version=v1
case v1.SchemeGroupVersion.WithKind("AppStatus"):
return &rayv1.AppStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("AuthOptions"):
return &rayv1.AuthOptionsApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("AutoscalerOptions"):
return &rayv1.AutoscalerOptionsApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("ClusterUpgradeOptions"):
return &rayv1.ClusterUpgradeOptionsApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("DeletionCondition"):
return &rayv1.DeletionConditionApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("DeletionPolicy"):
return &rayv1.DeletionPolicyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("DeletionRule"):
return &rayv1.DeletionRuleApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("DeletionStrategy"):
return &rayv1.DeletionStrategyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("GcsFaultToleranceOptions"):
return &rayv1.GcsFaultToleranceOptionsApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("HeadGroupSpec"):
return &rayv1.HeadGroupSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("HeadInfo"):
return &rayv1.HeadInfoApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("NetworkIsolationConfig"):
return &rayv1.NetworkIsolationConfigApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("NetworkPolicyRules"):
return &rayv1.NetworkPolicyRulesApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayCluster"):
return &rayv1.RayClusterApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayClusterSpec"):
return &rayv1.RayClusterSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayClusterStatus"):
return &rayv1.RayClusterStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayClusterUpgradeStrategy"):
return &rayv1.RayClusterUpgradeStrategyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayCronJob"):
return &rayv1.RayCronJobApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayCronJobSpec"):
return &rayv1.RayCronJobSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayCronJobStatus"):
return &rayv1.RayCronJobStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayJob"):
return &rayv1.RayJobApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayJobSpec"):
return &rayv1.RayJobSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayJobStatus"):
return &rayv1.RayJobStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayJobStatusInfo"):
return &rayv1.RayJobStatusInfoApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayService"):
return &rayv1.RayServiceApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayServiceSpec"):
return &rayv1.RayServiceSpecApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayServiceStatus"):
return &rayv1.RayServiceStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayServiceStatuses"):
return &rayv1.RayServiceStatusesApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RayServiceUpgradeStrategy"):
return &rayv1.RayServiceUpgradeStrategyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("RedisCredential"):
return &rayv1.RedisCredentialApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("ScaleStrategy"):
return &rayv1.ScaleStrategyApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("ServeDeploymentStatus"):
return &rayv1.ServeDeploymentStatusApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("SubmitterConfig"):
return &rayv1.SubmitterConfigApplyConfiguration{}
case v1.SchemeGroupVersion.WithKind("WorkerGroupSpec"):
return &rayv1.WorkerGroupSpecApplyConfiguration{}
}
return nil
}
func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter {
return managedfields.NewSchemeTypeConverter(scheme, internal.Parser())
}