forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#388 from apache-spark-on-k8s/branch-2.2-kub…
…ernetes-g Branch 2.2 kubernetes
- Loading branch information
Showing
181 changed files
with
13,281 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...ain/java/org/apache/spark/network/shuffle/kubernetes/KubernetesExternalShuffleClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.network.shuffle.kubernetes; | ||
|
||
import org.apache.spark.network.client.RpcResponseCallback; | ||
import org.apache.spark.network.client.TransportClient; | ||
import org.apache.spark.network.sasl.SecretKeyHolder; | ||
import org.apache.spark.network.shuffle.ExternalShuffleClient; | ||
import org.apache.spark.network.shuffle.protocol.RegisterDriver; | ||
import org.apache.spark.network.util.TransportConf; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
import java.nio.ByteBuffer; | ||
|
||
/** | ||
* A client for talking to the external shuffle service in Kubernetes cluster mode. | ||
* | ||
* This is used by the each Spark executor to register with a corresponding external | ||
* shuffle service on the cluster. The purpose is for cleaning up shuffle files | ||
* reliably if the application exits unexpectedly. | ||
*/ | ||
public class KubernetesExternalShuffleClient extends ExternalShuffleClient { | ||
private static final Logger logger = LoggerFactory | ||
.getLogger(KubernetesExternalShuffleClient.class); | ||
|
||
/** | ||
* Creates an Kubernetes external shuffle client that wraps the {@link ExternalShuffleClient}. | ||
* Please refer to docs on {@link ExternalShuffleClient} for more information. | ||
*/ | ||
public KubernetesExternalShuffleClient( | ||
TransportConf conf, | ||
SecretKeyHolder secretKeyHolder, | ||
boolean saslEnabled) { | ||
super(conf, secretKeyHolder, saslEnabled); | ||
} | ||
|
||
public void registerDriverWithShuffleService(String host, int port) | ||
throws IOException, InterruptedException { | ||
checkInit(); | ||
ByteBuffer registerDriver = new RegisterDriver(appId, 0).toByteBuffer(); | ||
TransportClient client = clientFactory.createClient(host, port); | ||
client.sendRpc(registerDriver, new RegisterDriverCallback()); | ||
} | ||
|
||
private class RegisterDriverCallback implements RpcResponseCallback { | ||
@Override | ||
public void onSuccess(ByteBuffer response) { | ||
logger.info("Successfully registered app " + appId + " with external shuffle service."); | ||
} | ||
|
||
@Override | ||
public void onFailure(Throwable e) { | ||
logger.warn("Unable to register app " + appId + " with external shuffle service. " + | ||
"Please manually remove shuffle data after driver exit. Error: " + e); | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
super.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: spark-resource-staging-server | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
resource-staging-server-instance: default | ||
spec: | ||
volumes: | ||
- name: resource-staging-server-properties | ||
configMap: | ||
name: spark-resource-staging-server-config | ||
containers: | ||
- name: spark-resource-staging-server | ||
image: kubespark/spark-resource-staging-server:v2.1.0-kubernetes-0.2.0 | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 256Mi | ||
limits: | ||
cpu: 100m | ||
memory: 256Mi | ||
volumeMounts: | ||
- name: resource-staging-server-properties | ||
mountPath: '/etc/spark-resource-staging-server' | ||
args: | ||
- '/etc/spark-resource-staging-server/resource-staging-server.properties' | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: spark-resource-staging-server-config | ||
data: | ||
resource-staging-server.properties: | | ||
spark.kubernetes.resourceStagingServer.port=10000 | ||
spark.ssl.kubernetes.resourceStagingServer.enabled=false | ||
# Other possible properties are listed below, primarily for setting up TLS. The paths given by KeyStore, password, and PEM files here should correspond to | ||
# files that are securely mounted into the resource staging server container, via e.g. secret volumes. | ||
# spark.ssl.kubernetes.resourceStagingServer.keyStore=/mnt/secrets/resource-staging-server/keyStore.jks | ||
# spark.ssl.kubernetes.resourceStagingServer.keyStorePassword=changeit | ||
# spark.ssl.kubernetes.resourceStagingServer.keyPassword=changeit | ||
# spark.ssl.kubernetes.resourceStagingServer.keyStorePasswordFile=/mnt/secrets/resource-staging-server/keystore-password.txt | ||
# spark.ssl.kubernetes.resourceStagingServer.keyPasswordFile=/mnt/secrets/resource-staging-server/keystore-key-password.txt | ||
# spark.ssl.kubernetes.resourceStagingServer.keyPem=/mnt/secrets/resource-staging-server/key.pem | ||
# spark.ssl.kubernetes.resourceStagingServer.serverCertPem=/mnt/secrets/resource-staging-server/cert.pem | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: spark-resource-staging-service | ||
spec: | ||
type: NodePort | ||
selector: | ||
resource-staging-server-instance: default | ||
ports: | ||
- protocol: TCP | ||
port: 10000 | ||
targetPort: 10000 | ||
nodePort: 31000 |
Oops, something went wrong.