|
8 | 8 | "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" |
9 | 9 | . "github.com/onsi/gomega" |
10 | 10 | corev1 "k8s.io/api/core/v1" |
11 | | - k8serrors "k8s.io/apimachinery/pkg/api/errors" |
12 | 11 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
13 | 12 |
|
14 | 13 | rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1" |
@@ -157,58 +156,3 @@ func ApplyAzureRayClusterWithCollector(test Test, g *WithT, namespace *corev1.Na |
157 | 156 | return rayCluster |
158 | 157 | } |
159 | 158 |
|
160 | | -// ApplyAzureHistoryServer deploys the HistoryServer configured for Azure Blob Storage. |
161 | | -func ApplyAzureHistoryServer(test Test, g *WithT, namespace *corev1.Namespace) { |
162 | | - sa, clusterRole, clusterRoleBinding := DeserializeRBACFromYAML(test, ServiceAccountManifestPath) |
163 | | - sa.Namespace = namespace.Name |
164 | | - clusterRoleBinding.Name = fmt.Sprintf("historyserver-%s", namespace.Name) |
165 | | - clusterRoleBinding.Subjects[0].Namespace = namespace.Name |
166 | | - |
167 | | - _, err := test.Client().Core().CoreV1().ServiceAccounts(namespace.Name).Create(test.Ctx(), sa, metav1.CreateOptions{}) |
168 | | - g.Expect(err).NotTo(HaveOccurred()) |
169 | | - |
170 | | - _, err = test.Client().Core().RbacV1().ClusterRoles().Create(test.Ctx(), clusterRole, metav1.CreateOptions{}) |
171 | | - if err != nil && !k8serrors.IsAlreadyExists(err) { |
172 | | - g.Expect(err).NotTo(HaveOccurred()) |
173 | | - } |
174 | | - |
175 | | - _, err = test.Client().Core().RbacV1().ClusterRoleBindings().Create(test.Ctx(), clusterRoleBinding, metav1.CreateOptions{}) |
176 | | - g.Expect(err).NotTo(HaveOccurred()) |
177 | | - |
178 | | - test.T().Cleanup(func() { |
179 | | - _ = test.Client().Core().RbacV1().ClusterRoleBindings().Delete( |
180 | | - context.Background(), clusterRoleBinding.Name, metav1.DeleteOptions{}) |
181 | | - }) |
182 | | - |
183 | | - KubectlApplyYAML(test, AzureHistoryServerManifestPath, namespace.Name) |
184 | | - |
185 | | - LogWithTimestamp(test.T(), "Waiting for Azure HistoryServer to be ready") |
186 | | - g.Eventually(func(gg Gomega) { |
187 | | - pods, err := test.Client().Core().CoreV1().Pods(namespace.Name).List( |
188 | | - test.Ctx(), metav1.ListOptions{ |
189 | | - LabelSelector: "app=historyserver", |
190 | | - }, |
191 | | - ) |
192 | | - gg.Expect(err).NotTo(HaveOccurred()) |
193 | | - gg.Expect(pods.Items).NotTo(BeEmpty()) |
194 | | - gg.Expect(AllPodsRunningAndReady(pods.Items)).To(BeTrue()) |
195 | | - }, TestTimeoutMedium).Should(Succeed()) |
196 | | - LogWithTimestamp(test.T(), "Azure HistoryServer is ready") |
197 | | -} |
198 | | - |
199 | | -// PrepareAzureHistoryServerTestEnv prepares test environment for Azure History Server tests. |
200 | | -func PrepareAzureHistoryServerTestEnv(test Test, g *WithT, namespace *corev1.Namespace, azureClient *azblob.Client) *rayv1.RayCluster { |
201 | | - rayCluster := ApplyAzureRayClusterWithCollector(test, g, namespace) |
202 | | - |
203 | | - headPod, err := GetHeadPod(test, rayCluster) |
204 | | - g.Expect(err).NotTo(HaveOccurred()) |
205 | | - g.Expect(headPod.Spec.Containers).To(ContainElement( |
206 | | - WithTransform(func(c corev1.Container) string { return c.Name }, Equal("collector")), |
207 | | - )) |
208 | | - |
209 | | - containerClient := azureClient.ServiceClient().NewContainerClient(AzureContainerName) |
210 | | - _, err = containerClient.GetProperties(context.Background(), nil) |
211 | | - g.Expect(err).NotTo(HaveOccurred()) |
212 | | - |
213 | | - return rayCluster |
214 | | -} |
0 commit comments