Skip to content

Instantly share code, notes, and snippets.

@jayunit100
Last active June 15, 2016 19:01
Show Gist options
  • Save jayunit100/3fad23e42a22e473fff7a45947bd3102 to your computer and use it in GitHub Desktop.
Save jayunit100/3fad23e42a22e473fff7a45947bd3102 to your computer and use it in GitHub Desktop.
kind: Template
apiVersion: v1
template: spark
metadata:
name: spark
labels:
app: sparktemplateforkedfromxpassspark
objects:
- kind: Service
apiVersion: v1
metadata:
name: ${MASTER_NAME}
labels:
name: ${MASTER_NAME}
spec:
ports:
- protocol: TCP
port: 7077
targetPort: 7077
selector:
name: ${MASTER_NAME}
- kind: Service
apiVersion: v1
metadata:
name: ${MASTER_NAME}-webui
labels:
name: ${MASTER_NAME}
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
selector:
name: ${MASTER_NAME}
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: ${MASTER_NAME}
spec:
strategy:
type: Rolling
triggers:
- type: ConfigChange
replicas: 1
selector:
name: ${MASTER_NAME}
template:
metadata:
labels:
name: ${MASTER_NAME}
spec:
containers:
- name: ${MASTER_NAME}
image: ${SPARK_IMAGE}
env:
- name: SPARK_MASTER_PORT
value: "7077"
- name: SPARK_MASTER_WEBUI_PORT
value: "8080"
ports:
- containerPort: 7077
protocol: TCP
- containerPort: 8080
protocol: TCP
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: ${WORKER_NAME}
spec:
strategy:
type: Rolling
triggers:
- type: ConfigChange
replicas: 3
selector:
name: ${WORKER_NAME}
template:
metadata:
labels:
name: ${WORKER_NAME}
spec:
containers:
- name: ${WORKER_NAME}
image: ${SPARK_IMAGE}
env:
- name: SPARK_MASTER_ADDRESS
value: "spark://${MASTER_NAME}:7077"
parameters:
- name: SPARK_IMAGE
description: Name of the Spark master/worker image (value might be ce-registry.usersys.redhat.com/apache-spark-2/spark20-hadoop27-openshift:2.0?)
required: true
- name: MASTER_NAME
description: master name used as a service name and a selector
generate: expression
from: "spark-master-[a-z0-9]{4}"
required: true
- name: WORKER_NAME
description: worker name used as a selector
generate: expression
from: "spark-worker-[a-z0-9]{4}"
required: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment