Skip to content

Instantly share code, notes, and snippets.

@sub-mod
Last active October 20, 2017 18:04
Show Gist options
  • Save sub-mod/f31cc95c8af95eccbf58ed2c39ce3b19 to your computer and use it in GitHub Desktop.
Save sub-mod/f31cc95c8af95eccbf58ed2c39ce3b19 to your computer and use it in GitHub Desktop.
oshinko-pyspark-sc.json
{
"apiVersion": "v1",
"kind": "Template",
"labels": {
"application": "oshinko-pyspark",
"createdBy": "template-oshinko-pyspark-build-dc"
},
"metadata": {
"annotations": {
"openshift.io/display-name": "PySpark",
"description": "Create a buildconfig, imagestream and deploymentconfig using source-to-image and pyspark source hosted in git",
"template.openshift.io/long-description": "",
"template.openshift.io/provider-display-name": "Red Hat, Inc.",
"template.openshift.io/documentation-url": "http://radanalytics.io",
"template.openshift.io/support-url": "https://access.redhat.com"
},
"name": "oshinko-pyspark-build-dc"
},
"objects": [{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": {
"name": "${APPLICATION_NAME}-sa",
"labels": {
"appName": "${APPLICATION_NAME}"
}
}
},
{
"apiVersion": "v1",
"kind": "RoleBinding",
"metadata": {
"name": "${APPLICATION_NAME}-oshinko-edit",
"labels": {
"appName": "${APPLICATION_NAME}"
}
},
"roleRef": {
"name": "edit"
},
"subjects": [{
"kind": "ServiceAccount",
"name": "${APPLICATION_NAME}-sa"
}]
},
{
"apiVersion": "v1",
"kind": "ImageStream",
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}",
"appName": "${APPLICATION_NAME}"
},
"name": "${APPLICATION_NAME}"
},
"spec": {
"dockerImageRepository": "${APPLICATION_NAME}",
"tags": [{
"name": "latest"
}]
}
},
{
"apiVersion": "v1",
"kind": "BuildConfig",
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}",
"appName": "${APPLICATION_NAME}"
},
"name": "${APPLICATION_NAME}"
},
"spec": {
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "${APPLICATION_NAME}:latest"
}
},
"source": {
"git": {
"ref": "${GIT_REF}",
"uri": "${GIT_URI}"
},
"type": "Git"
},
"strategy": {
"sourceStrategy": {
"env": [{
"name": "APP_FILE",
"value": "${APP_FILE}"
}],
"forcePull": true,
"from": {
"kind": "DockerImage",
"name": "radanalyticsio/radanalytics-pyspark:stable"
},
"type": "Source"
}
},
"triggers": [{
"type": "ConfigChange"
},
{
"imageChange": {},
"type": "ImageChange"
},
{
"github": {
"secret": "${APPLICATION_NAME}"
},
"type": "GitHub"
},
{
"generic": {
"secret": "${APPLICATION_NAME}"
},
"type": "Generic"
}
]
}
},
{
"apiVersion": "v1",
"kind": "DeploymentConfig",
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}",
"appName": "${APPLICATION_NAME}"
},
"name": "${APPLICATION_NAME}"
},
"spec": {
"replicas": 1,
"selector": {
"deploymentconfig": "${APPLICATION_NAME}"
},
"strategy": {
"type": "Rolling"
},
"template": {
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}",
"deploymentconfig": "${APPLICATION_NAME}"
}
},
"spec": {
"containers": [{
"env": [{
"name": "OSHINKO_CLUSTER_NAME",
"value": "${OSHINKO_CLUSTER_NAME}"
},
{
"name": "APP_ARGS",
"value": "${APP_ARGS}"
},
{
"name": "SPARK_OPTIONS",
"value": "${SPARK_OPTIONS}"
},
{
"name": "OSHINKO_DEL_CLUSTER",
"value": "${OSHINKO_DEL_CLUSTER}"
},
{
"name": "APP_EXIT",
"value": "true"
},
{
"name": "OSHINKO_NAMED_CONFIG",
"value": "${OSHINKO_NAMED_CONFIG}"
},
{
"name": "OSHINKO_SPARK_DRIVER_CONFIG",
"value": "${OSHINKO_SPARK_DRIVER_CONFIG}"
},
{
"name": "POD_NAME",
"valueFrom": {
"fieldRef": {
"fieldPath": "metadata.name"
}
}
}
],
"image": "${APPLICATION_NAME}",
"imagePullPolicy": "Always",
"name": "${APPLICATION_NAME}",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"volumeMounts": [{
"mountPath": "/etc/podinfo",
"name": "podinfo",
"readOnly": false
}]
}],
"dnsPolicy": "ClusterFirst",
"restartPolicy": "Always",
"serviceAccount": "${APPLICATION_NAME}-sa",
"volumes": [{
"downwardAPI": {
"items": [{
"fieldRef": {
"fieldPath": "metadata.labels"
},
"path": "labels"
}]
},
"name": "podinfo"
}]
}
},
"triggers": [{
"type": "ConfigChange"
},
{
"imageChangeParams": {
"automatic": true,
"containerNames": [
"${APPLICATION_NAME}"
],
"from": {
"kind": "ImageStreamTag",
"name": "${APPLICATION_NAME}:latest"
}
},
"type": "ImageChange"
}
]
}
},
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}",
"appName": "${APPLICATION_NAME}"
},
"name": "${APPLICATION_NAME}"
},
"spec": {
"ports": [{
"name": "8080-tcp",
"port": 8080,
"protocol": "TCP",
"targetPort": 8080
}],
"selector": {
"deploymentconfig": "${APPLICATION_NAME}"
}
}
}
],
"parameters": [{
"description": "The name to use for the BuildConfig, ImageStream and DeploymentConfig components",
"displayName": "Application Name",
"from": "pyspark-[a-z0-9]{4}",
"generate": "expression",
"name": "APPLICATION_NAME"
},
{
"description": "The URL of the repository with your application source code",
"displayName": "Git Repository URL",
"name": "GIT_URI",
"required": true
},
{
"description": "Command line arguments to pass to the application",
"displayName": "Application Arguments",
"name": "APP_ARGS"
},
{
"description": "List of additional options to pass to spark-submit (for exmaple --conf property=value or --package ...). --master and --class are set by the launcher and should not be set here.",
"displayName": "spark-submit Options",
"name": "SPARK_OPTIONS"
},
{
"description": "Optional branch, tag or commit",
"displayName": "Git Reference",
"name": "GIT_REF"
},
{
"description": "The name of the spark cluster to run against. The cluster will be created if it does not exist, and a random cluster name will be chosen if this value is left blank.",
"name": "OSHINKO_CLUSTER_NAME"
},
{
"description": "The name of a stored cluster configuration to use if a cluster is created, default is 'default'.",
"name": "OSHINKO_NAMED_CONFIG"
},
{
"description": "The name of a configmap to use for the spark configuration of the driver. If this configmap is empty the default spark configuration will be used.",
"name": "OSHINKO_SPARK_DRIVER_CONFIG"
},
{
"description": "If a cluster is created on-demand, delete the cluster when the application finishes if this option is set to 'true'",
"name": "OSHINKO_DEL_CLUSTER",
"required": true,
"value": "true"
},
{
"description": "The name of the main py file to run. If this is not specified and there is a single py file at top level of the git respository, that file will be chosen.",
"name": "APP_FILE"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment