spark_on_k8s.connect_server¶
See the reference overview for supported entry points and task guides. A module may also contain helpers outside the documented public API.
ConnectServerConfig
dataclass
¶
Explicit inputs for one private, single-driver Spark Connect server.
The image must contain the specified Connect server JAR and a Spark entrypoint. This configuration creates neither namespaces nor service accounts. Its plaintext ClusterIP service requires a trusted network or a separately managed gateway.
Pod placement and credentials reference existing Kubernetes objects only:
image_pull_secrets names Secrets used for the driver and executors;
driver_env_from_secrets and executor_env_from_secrets map environment
variable names to SECRET:KEY references, resolved by the kubelet (this helper
never reads Secret values); node selectors map node label keys to values; and
tolerations are Kubernetes toleration mappings (key, operator, value,
effect, tolerationSeconds).
An optional max_runtime (seconds) stops the server's driver even if no client deletes it.
Source code in spark_on_k8s/connect_server.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
ConnectServerCreateError
¶
Bases: ConnectServerError
Creation failed; inspect run, phase and cleanup for partial resource effects.
Source code in spark_on_k8s/connect_server.py
384 385 | |
ConnectServerError
¶
Bases: RuntimeError
Server operation failed without interpreting uncertainty as absence.
Source code in spark_on_k8s/connect_server.py
373 374 375 376 377 378 379 380 381 | |
ConnectServerHandle
dataclass
¶
Credential-free identity for a server and both owned Kubernetes Services.
Source code in spark_on_k8s/connect_server.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
endpoint
property
¶
Return the private cluster DNS endpoint; no credentials are included.
ConnectServerOwnershipError
¶
Bases: ConnectServerError
Observed resources do not match the recorded identity; no adoption is allowed.
Source code in spark_on_k8s/connect_server.py
388 389 | |
ConnectServerTimeout
¶
Bases: TimeoutError
Readiness observation expired; the server was not deleted.
Source code in spark_on_k8s/connect_server.py
392 393 394 395 396 397 398 399 400 401 | |
connect_server_status(client, handle, *, timeout=10)
¶
Read matching resource state. Only confirmed 404 means missing; errors propagate.
Source code in spark_on_k8s/connect_server.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | |
create_connect_server(client, config)
¶
Create a driver and private gRPC Service, without claiming query readiness.
A failed create attempts rollback only after receiving a confirmed driver UID. A timeout with no confirmed UID is uncertain: no retry, adoption or deletion occurs. The raised error retains the planned/confirmed run and rollback outcome.
Source code in spark_on_k8s/connect_server.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | |
delete_connect_server(client, handle, *, timeout=10)
¶
Verify all three resource identities before requesting UID-conditional deletion.
Missing resources are idempotent. Success means deletion was requested, not that executors or Services have already disappeared. A concurrent change can interrupt a partially applied deletion; UID preconditions protect replacement resources.
Source code in spark_on_k8s/connect_server.py
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | |
list_connect_servers(client, namespace, *, timeout=10)
¶
List driver pods labeled as servers created by this helper in one namespace, oldest first.
This is a read-only, label-based observation: it neither verifies receipts, Services or query readiness nor deletes anything. A matching label is not proof of ownership; deletion still requires the recorded identity checks. Errors propagate.
Source code in spark_on_k8s/connect_server.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | |
plan_connect_server(client, config)
¶
Render the resources create_connect_server would request, without cluster access.
The plan uses the same submission builder as creation plus the gRPC Service. Secret settings appear only as Secret names and keys: no Secret is read, so no value can appear. Identifiers are illustrative; nothing is created or reserved.
Source code in spark_on_k8s/connect_server.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
wait_connect_server_ready(client, handle, *, profile, timeout=60, poll_interval=1)
¶
Require a real query against this application, then revalidate Kubernetes identity.
Source code in spark_on_k8s/connect_server.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |