-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add ValidateRayClusterSpec to Webhook #2739
Open
CheyuWu
wants to merge
13
commits into
ray-project:master
Choose a base branch
from
CheyuWu:feat/gcsFT/webhook_val
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0a1d604
feat: add ValidateRayClusterSpec in raycluster webhook and add unit test
CheyuWu f78dd69
fix: linter issue
CheyuWu 20f47ec
feat: add ValidateRayClusterSpec in raycluster webhook, copy necessar…
CheyuWu f742941
fix: reference duplicate func and constant variables
CheyuWu ff87926
fix: rm Containers[RayContainerIndex].Env check which is not necessar…
CheyuWu f686791
refactor: mv IsGCSFaultToleranceEnabled to rayv1 and reference to ori…
CheyuWu da307bb
refactor: mv utils constant REDIS_PASSWORD to rayv1 constant
CheyuWu 72c0e91
fix: correct the test name in raycluster_controller_unit_test.go, cha…
CheyuWu 8ba5b91
test: add unit test for EnvVarExists
CheyuWu b8c8fc0
fix: linter issue
CheyuWu 6ef8e8c
fix: add container in when name is invalid testcase
CheyuWu ed58672
fix: add RayStartParams in workerGroupSpec
CheyuWu 41a0ac7
fix workergroupSpec invalid info
CheyuWu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package v1 | ||
|
||
const ( | ||
// In KubeRay, the Ray container must be the first application container in a head or worker Pod. | ||
RayContainerIndex = 0 | ||
|
||
// Use as container env variable | ||
RAY_REDIS_ADDRESS = "RAY_REDIS_ADDRESS" | ||
REDIS_PASSWORD = "REDIS_PASSWORD" | ||
// Ray GCS FT related annotations | ||
RayFTEnabledAnnotationKey = "ray.io/ft-enabled" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package v1 | ||
|
||
import "strings" | ||
|
||
func IsGCSFaultToleranceEnabled(instance RayCluster) bool { | ||
v, ok := instance.Annotations[RayFTEnabledAnnotationKey] | ||
return (ok && strings.ToLower(v) == "true") || instance.Spec.GcsFaultToleranceOptions != nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package v1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func TestIsGCSFaultToleranceEnabled(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
instance RayCluster | ||
expected bool | ||
}{ | ||
{ | ||
name: "ray.io/ft-enabled is true", | ||
instance: RayCluster{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Annotations: map[string]string{ | ||
RayFTEnabledAnnotationKey: "true", | ||
}, | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "ray.io/ft-enabled is false", | ||
instance: RayCluster{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Annotations: map[string]string{ | ||
RayFTEnabledAnnotationKey: "false", | ||
}, | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
{ | ||
name: "ray.io/ft-enabled is nil, GcsFaultToleranceOptions is not nil", | ||
instance: RayCluster{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Annotations: map[string]string{}, | ||
}, | ||
Spec: RayClusterSpec{ | ||
GcsFaultToleranceOptions: &GcsFaultToleranceOptions{}, | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "ray.io/ft-enabled is nil, GcsFaultToleranceOptions is nil", | ||
instance: RayCluster{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Annotations: map[string]string{}, | ||
}, | ||
Spec: RayClusterSpec{ | ||
GcsFaultToleranceOptions: nil, | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
result := IsGCSFaultToleranceEnabled(tt.instance) | ||
assert.Equal(t, tt.expected, result) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.