|
74 | 74 | gen_names,
|
75 | 75 | is_openshift_cluster,
|
76 | 76 | read_template,
|
77 |
| - enable_local_interactive, |
78 | 77 | write_components,
|
79 | 78 | )
|
80 | 79 |
|
@@ -258,7 +257,6 @@ def test_config_creation():
|
258 | 257 | assert config.image_pull_secrets == ["unit-test-pull-secret"]
|
259 | 258 | assert config.dispatch_priority == None
|
260 | 259 | assert config.mcad == True
|
261 |
| - assert config.local_interactive == False |
262 | 260 |
|
263 | 261 |
|
264 | 262 | def ca_secret_support(path, mcad: bool):
|
@@ -746,7 +744,6 @@ def test_local_client_url(mocker):
|
746 | 744 | cluster_config = ClusterConfiguration(
|
747 | 745 | name="unit-test-cluster-localinter",
|
748 | 746 | namespace="ns",
|
749 |
| - local_interactive=True, |
750 | 747 | write_to_file=True,
|
751 | 748 | )
|
752 | 749 | cluster = Cluster(cluster_config)
|
@@ -1062,9 +1059,6 @@ def get_ray_obj(group, version, namespace, plural, cls=None):
|
1062 | 1059 | "metadata": {
|
1063 | 1060 | "creationTimestamp": "2024-03-05T09:55:37Z",
|
1064 | 1061 | "generation": 1,
|
1065 |
| - "annotations": { |
1066 |
| - "sdk.codeflare.dev/local_interactive": "True", |
1067 |
| - }, |
1068 | 1062 | "labels": {
|
1069 | 1063 | "appwrapper.mcad.ibm.com": "quicktest",
|
1070 | 1064 | "controller-tools.k8s.io": "1.0",
|
@@ -1874,9 +1868,6 @@ def get_aw_obj(group, version, namespace, plural):
|
1874 | 1868 | "apiVersion": "ray.io/v1",
|
1875 | 1869 | "kind": "RayCluster",
|
1876 | 1870 | "metadata": {
|
1877 |
| - "annotations": { |
1878 |
| - "sdk.codeflare.dev/local_interactive": "False" |
1879 |
| - }, |
1880 | 1871 | "labels": {
|
1881 | 1872 | "workload.codeflare.dev/appwrapper": "quicktest1",
|
1882 | 1873 | "controller-tools.k8s.io": "1.0",
|
@@ -2204,9 +2195,6 @@ def get_aw_obj(group, version, namespace, plural):
|
2204 | 2195 | "apiVersion": "ray.io/v1",
|
2205 | 2196 | "kind": "RayCluster",
|
2206 | 2197 | "metadata": {
|
2207 |
| - "annotations": { |
2208 |
| - "sdk.codeflare.dev/local_interactive": "False" |
2209 |
| - }, |
2210 | 2198 | "labels": {
|
2211 | 2199 | "workload.codeflare.dev/appwrapper": "quicktest2",
|
2212 | 2200 | "controller-tools.k8s.io": "1.0",
|
@@ -2518,7 +2506,6 @@ def custom_side_effect(group, version, namespace, plural, **kwargs):
|
2518 | 2506 | assert cluster_config.min_cpus == 1 and cluster_config.max_cpus == 1
|
2519 | 2507 | assert cluster_config.min_memory == 2 and cluster_config.max_memory == 2
|
2520 | 2508 | assert cluster_config.num_gpus == 0
|
2521 |
| - assert cluster_config.local_interactive == True |
2522 | 2509 | assert (
|
2523 | 2510 | cluster_config.image
|
2524 | 2511 | == "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"
|
@@ -2552,7 +2539,6 @@ def test_get_cluster(mocker):
|
2552 | 2539 | assert cluster_config.min_memory == 2 and cluster_config.max_memory == 2
|
2553 | 2540 | assert cluster_config.num_gpus == 0
|
2554 | 2541 | assert cluster_config.instascale
|
2555 |
| - assert cluster_config.local_interactive |
2556 | 2542 | assert (
|
2557 | 2543 | cluster_config.image
|
2558 | 2544 | == "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"
|
@@ -3082,120 +3068,6 @@ def test_export_env():
|
3082 | 3068 | )
|
3083 | 3069 |
|
3084 | 3070 |
|
3085 |
| -# def test_enable_local_interactive(mocker): |
3086 |
| -# template = f"{parent}/src/codeflare_sdk/templates/base-template.yaml" |
3087 |
| -# user_yaml = read_template(template) |
3088 |
| -# aw_spec = user_yaml.get("spec", None) |
3089 |
| -# cluster_name = "test-enable-local" |
3090 |
| -# namespace = "default" |
3091 |
| -# ingress_domain = "mytest.domain" |
3092 |
| -# mocker.patch("kubernetes.client.ApisApi.get_api_versions") |
3093 |
| -# mocker.patch( |
3094 |
| -# "codeflare_sdk.utils.generate_yaml.is_openshift_cluster", return_value=False |
3095 |
| -# ) |
3096 |
| -# volume_mounts = [ |
3097 |
| -# {"name": "ca-vol", "mountPath": "/home/ray/workspace/ca", "readOnly": True}, |
3098 |
| -# { |
3099 |
| -# "name": "server-cert", |
3100 |
| -# "mountPath": "/home/ray/workspace/tls", |
3101 |
| -# "readOnly": False, |
3102 |
| -# }, |
3103 |
| -# ] |
3104 |
| -# volumes = [ |
3105 |
| -# { |
3106 |
| -# "name": "ca-vol", |
3107 |
| -# "secret": {"secretName": "ca-secret-test-enable-local"}, |
3108 |
| -# "optional": False, |
3109 |
| -# }, |
3110 |
| -# {"name": "server-cert", "emptyDir": {}}, |
3111 |
| -# { |
3112 |
| -# "name": "odh-trusted-ca-cert", |
3113 |
| -# "configMap": { |
3114 |
| -# "name": "odh-trusted-ca-bundle", |
3115 |
| -# "items": [ |
3116 |
| -# {"key": "ca-bundle.crt", "path": "odh-trusted-ca-bundle.crt"} |
3117 |
| -# ], |
3118 |
| -# "optional": True, |
3119 |
| -# }, |
3120 |
| -# }, |
3121 |
| -# { |
3122 |
| -# "name": "odh-ca-cert", |
3123 |
| -# "configMap": { |
3124 |
| -# "name": "odh-trusted-ca-bundle", |
3125 |
| -# "items": [{"key": "odh-ca-bundle.crt", "path": "odh-ca-bundle.crt"}], |
3126 |
| -# "optional": True, |
3127 |
| -# }, |
3128 |
| -# }, |
3129 |
| -# ] |
3130 |
| -# tls_env = [ |
3131 |
| -# {"name": "RAY_USE_TLS", "value": "1"}, |
3132 |
| -# {"name": "RAY_TLS_SERVER_CERT", "value": "/home/ray/workspace/tls/server.crt"}, |
3133 |
| -# {"name": "RAY_TLS_SERVER_KEY", "value": "/home/ray/workspace/tls/server.key"}, |
3134 |
| -# {"name": "RAY_TLS_CA_CERT", "value": "/home/ray/workspace/tls/ca.crt"}, |
3135 |
| -# ] |
3136 |
| -# assert aw_spec != None |
3137 |
| -# enable_local_interactive(aw_spec, cluster_name, namespace, ingress_domain) |
3138 |
| -# head_group_spec = aw_spec["resources"]["GenericItems"][0]["generictemplate"][ |
3139 |
| -# "spec" |
3140 |
| -# ]["headGroupSpec"] |
3141 |
| -# worker_group_spec = aw_spec["resources"]["GenericItems"][0]["generictemplate"][ |
3142 |
| -# "spec" |
3143 |
| -# ]["workerGroupSpecs"] |
3144 |
| -# ca_secret = aw_spec["resources"]["GenericItems"][1]["generictemplate"] |
3145 |
| -# # At a minimal, make sure the following items are presented in the appwrapper spec.resources. |
3146 |
| -# # 1. headgroup has the initContainers command to generated TLS cert from the mounted CA cert. |
3147 |
| -# # Note: In this particular command, the DNS.5 in [alt_name] must match the exposed local_client_url: rayclient-{cluster_name}.{namespace}.{ingress_domain} |
3148 |
| -# assert ( |
3149 |
| -# head_group_spec["template"]["spec"]["initContainers"][0]["command"][2] |
3150 |
| -# == f"cd /home/ray/workspace/tls && openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj '/CN=ray-head' && printf \"authorityKeyIdentifier=keyid,issuer\\nbasicConstraints=CA:FALSE\\nsubjectAltName = @alt_names\\n[alt_names]\\nDNS.1 = 127.0.0.1\\nDNS.2 = localhost\\nDNS.3 = ${{FQ_RAY_IP}}\\nDNS.4 = $(awk 'END{{print $1}}' /etc/hosts)\\nDNS.5 = rayclient-{cluster_name}-$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).{ingress_domain}\">./domain.ext && cp /home/ray/workspace/ca/* . && openssl x509 -req -CA ca.crt -CAkey ca.key -in server.csr -out server.crt -days 365 -CAcreateserial -extfile domain.ext" |
3151 |
| -# ) |
3152 |
| -# assert ( |
3153 |
| -# head_group_spec["template"]["spec"]["initContainers"][0]["volumeMounts"] |
3154 |
| -# == volume_mounts |
3155 |
| -# ) |
3156 |
| -# assert head_group_spec["template"]["spec"]["volumes"] == volumes |
3157 |
| - |
3158 |
| -# # 2. workerGroupSpec has the initContainers command to generated TLS cert from the mounted CA cert. |
3159 |
| -# assert ( |
3160 |
| -# worker_group_spec[0]["template"]["spec"]["initContainers"][0]["command"][2] |
3161 |
| -# == "cd /home/ray/workspace/tls && openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj '/CN=ray-head' && printf \"authorityKeyIdentifier=keyid,issuer\\nbasicConstraints=CA:FALSE\\nsubjectAltName = @alt_names\\n[alt_names]\\nDNS.1 = 127.0.0.1\\nDNS.2 = localhost\\nDNS.3 = ${FQ_RAY_IP}\\nDNS.4 = $(awk 'END{print $1}' /etc/hosts)\">./domain.ext && cp /home/ray/workspace/ca/* . && openssl x509 -req -CA ca.crt -CAkey ca.key -in server.csr -out server.crt -days 365 -CAcreateserial -extfile domain.ext" |
3162 |
| -# ) |
3163 |
| -# assert ( |
3164 |
| -# worker_group_spec[0]["template"]["spec"]["initContainers"][0]["volumeMounts"] |
3165 |
| -# == volume_mounts |
3166 |
| -# ) |
3167 |
| -# assert worker_group_spec[0]["template"]["spec"]["volumes"] == volumes |
3168 |
| - |
3169 |
| -# # 3. Required Envs to enable TLS encryption between head and workers |
3170 |
| -# for i in range(len(tls_env)): |
3171 |
| -# assert ( |
3172 |
| -# head_group_spec["template"]["spec"]["containers"][0]["env"][i + 1]["name"] |
3173 |
| -# == tls_env[i]["name"] |
3174 |
| -# ) |
3175 |
| -# assert ( |
3176 |
| -# head_group_spec["template"]["spec"]["containers"][0]["env"][i + 1]["value"] |
3177 |
| -# == tls_env[i]["value"] |
3178 |
| -# ) |
3179 |
| -# assert ( |
3180 |
| -# worker_group_spec[0]["template"]["spec"]["containers"][0]["env"][i + 1][ |
3181 |
| -# "name" |
3182 |
| -# ] |
3183 |
| -# == tls_env[i]["name"] |
3184 |
| -# ) |
3185 |
| -# assert ( |
3186 |
| -# worker_group_spec[0]["template"]["spec"]["containers"][0]["env"][i + 1][ |
3187 |
| -# "value" |
3188 |
| -# ] |
3189 |
| -# == tls_env[i]["value"] |
3190 |
| -# ) |
3191 |
| - |
3192 |
| -# # 4. Secret with ca.crt and ca.key |
3193 |
| -# assert ca_secret["kind"] == "Secret" |
3194 |
| -# assert ca_secret["data"]["ca.crt"] != None |
3195 |
| -# assert ca_secret["data"]["ca.key"] != None |
3196 |
| -# assert ca_secret["metadata"]["name"] == f"ca-secret-{cluster_name}" |
3197 |
| -# assert ca_secret["metadata"]["namespace"] == namespace |
3198 |
| - |
3199 | 3071 | """
|
3200 | 3072 | Ray Jobs tests
|
3201 | 3073 | """
|
|
0 commit comments