Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions historyserver/config/historyserver-azureblob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: Service
metadata:
name: historyserver
labels:
app: historyserver
spec:
selector:
app: historyserver
ports:
- protocol: TCP
name: http
port: 30080
targetPort: 8080
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: historyserver-demo
labels:
app: historyserver
spec:
replicas: 1
selector:
matchLabels:
app: historyserver
template:
metadata:
labels:
app: historyserver
spec:
serviceAccountName: historyserver
containers:
- name: historyserver
env:
- name: AZURE_STORAGE_CONNECTION_STRING
value: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite-service.azurite-dev.svc.cluster.local:10000/devstoreaccount1;"
- name: AZURE_STORAGE_CONTAINER
value: "ray-historyserver"
image: historyserver:v0.1.0
imagePullPolicy: IfNotPresent
command:
- historyserver
- --runtime-class-name=azureblob
- --ray-root-dir=log
ports:
- containerPort: 8080
resources:
limits:
cpu: "500m"
3 changes: 2 additions & 1 deletion historyserver/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Sample configs are in the `config/` directory:
| `raycluster.yaml` | Ray cluster with collector sidecar (S3/MinIO) |
| `raycluster-azureblob.yaml` | Ray cluster with collector sidecar (Azure Blob) |
| `rayjob.yaml` | Sample Ray job for testing |
| `historyserver.yaml` | History Server deployment |
| `historyserver.yaml` | History Server deployment (S3/MinIO) |
| `historyserver-azureblob.yaml` | History Server deployment (Azure Blob) |
| `service_account.yaml` | Service account for History Server |

## Additional resources
Expand Down
53 changes: 53 additions & 0 deletions historyserver/test/e2e/historyserver_azureblob_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package e2e

import (
"testing"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

. "github.com/ray-project/kuberay/historyserver/test/support"
. "github.com/ray-project/kuberay/ray-operator/test/support"
)

func TestAzureHistoryServer(t *testing.T) {
azureClient := EnsureAzureBlobClient(t)

tests := []struct {
name string
testFunc func(Test, *WithT, *corev1.Namespace, *azblob.Client)
}{
{
name: "Live cluster: historyserver endpoints should be accessible",
testFunc: testAzureLiveClusters,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
test := With(t)
g := NewWithT(t)
namespace := test.NewTestNamespace()

tt.testFunc(test, g, namespace, azureClient)
})
}
}

func testAzureLiveClusters(test Test, g *WithT, namespace *corev1.Namespace, azureClient *azblob.Client) {
rayCluster := PrepareAzureBlobTestEnv(test, g, namespace, azureClient)
ApplyRayJobAndWaitForCompletion(test, g, namespace, rayCluster)
ApplyHistoryServer(test, g, namespace, AzureHistoryServerManifestPath)
historyServerURL := GetHistoryServerURL(test, g, namespace)

clusterInfo := getClusterFromList(test, g, historyServerURL, rayCluster.Name, namespace.Name)
g.Expect(clusterInfo.SessionName).To(Equal(LiveSessionName), "Live cluster should have sessionName='live'")

client := CreateHTTPClientWithCookieJar(g)
setClusterContext(test, g, client, historyServerURL, namespace.Name, rayCluster.Name, clusterInfo.SessionName)
verifyHistoryServerEndpoints(test, g, client, historyServerURL)

DeleteAzureBlobContainer(test, g, azureClient)
LogWithTimestamp(test.T(), "Azure live clusters E2E test completed successfully")
}
2 changes: 1 addition & 1 deletion historyserver/test/e2e/historyserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestHistoryServer(t *testing.T) {
func testLiveClusters(test Test, g *WithT, namespace *corev1.Namespace, s3Client *s3.S3) {
rayCluster := PrepareTestEnv(test, g, namespace, s3Client)
ApplyRayJobAndWaitForCompletion(test, g, namespace, rayCluster)
ApplyHistoryServer(test, g, namespace)
ApplyHistoryServer(test, g, namespace, "")
historyServerURL := GetHistoryServerURL(test, g, namespace)

clusterInfo := getClusterFromList(test, g, historyServerURL, rayCluster.Name, namespace.Name)
Expand Down
3 changes: 2 additions & 1 deletion historyserver/test/support/azureblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const (
AzureContainerName = "ray-historyserver"

// Azure-specific RayCluster config
AzureRayClusterManifestPath = "../../config/raycluster-azureblob.yaml"
AzureRayClusterManifestPath = "../../config/raycluster-azureblob.yaml"
AzureHistoryServerManifestPath = "../../config/historyserver-azureblob.yaml"
)

// ApplyAzurite deploys Azurite once per test namespace.
Expand Down
11 changes: 8 additions & 3 deletions historyserver/test/support/historyserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ var HistoryServerEndpoints = []string{
const HistoryServerEndpointGrafanaHealth = "/api/grafana_health"

// ApplyHistoryServer deploys the HistoryServer and RBAC resources.
func ApplyHistoryServer(test Test, g *WithT, namespace *corev1.Namespace) {
// Read RBAC resources from YAML and modify namespace fields.
// If manifestPath is empty, the default HistoryServerManifestPath is used.
func ApplyHistoryServer(test Test, g *WithT, namespace *corev1.Namespace, manifestPath string) {
if manifestPath == "" {
manifestPath = HistoryServerManifestPath
}

sa, clusterRole, clusterRoleBinding := DeserializeRBACFromYAML(test, ServiceAccountManifestPath)
sa.Namespace = namespace.Name
clusterRoleBinding.Name = fmt.Sprintf("historyserver-%s", namespace.Name)
Expand All @@ -88,6 +92,7 @@ func ApplyHistoryServer(test Test, g *WithT, namespace *corev1.Namespace) {
if err != nil && !k8serrors.IsAlreadyExists(err) {
g.Expect(err).NotTo(HaveOccurred())
}

_, err = test.Client().Core().RbacV1().ClusterRoleBindings().Create(test.Ctx(), clusterRoleBinding, metav1.CreateOptions{})
g.Expect(err).NotTo(HaveOccurred())

Expand All @@ -98,7 +103,7 @@ func ApplyHistoryServer(test Test, g *WithT, namespace *corev1.Namespace) {
context.Background(), clusterRoleBinding.Name, metav1.DeleteOptions{})
})

KubectlApplyYAML(test, HistoryServerManifestPath, namespace.Name)
KubectlApplyYAML(test, manifestPath, namespace.Name)

LogWithTimestamp(test.T(), "Waiting for HistoryServer to be ready")
g.Eventually(func(gg Gomega) {
Expand Down
Loading