private static Service buildMasterService()

in spark-submission-worker/src/main/java/org/apache/spark/k8s/operator/SparkClusterResourceSpec.java [109:139]


  private static Service buildMasterService(
      String name, String namespace, String version, ObjectMeta metadata, ServiceSpec serviceSpec) {
    return new ServiceBuilder()
        .withNewMetadataLike(metadata)
        .withName(name + "-master-svc")
        .addToLabels(LABEL_SPARK_ROLE_NAME, LABEL_SPARK_ROLE_MASTER_VALUE)
        .addToLabels(LABEL_SPARK_VERSION_NAME, version)
        .withNamespace(namespace)
        .endMetadata()
        .withNewSpecLike(serviceSpec)
        .withClusterIP("None")
        .withSelector(
            Collections.singletonMap(LABEL_SPARK_ROLE_NAME, LABEL_SPARK_ROLE_MASTER_VALUE))
        .addNewPort()
        .withName("web")
        .withPort(8080)
        .withNewTargetPort("web")
        .endPort()
        .addNewPort()
        .withName("spark")
        .withPort(7077)
        .withNewTargetPort("spark")
        .endPort()
        .addNewPort()
        .withName("rest")
        .withPort(6066)
        .withNewTargetPort("rest")
        .endPort()
        .endSpec()
        .build();
  }