{
    "apiVersion": "v1",
    "kind": "Template",
    "message": "The following service(s) have been created in your project: ${NAME}.\n\n",
    "metadata": {
        "annotations": {
            "description": "Build a basic React Web Application",
            "iconClass": "icon-js",
            "openshift.io/display-name": "React Web Application",
            "tags": "nodejs, react, web app",
            "template.openshift.io/provider-display-name": "Red Hat, Inc."
        },
        "name": "react-web-app-example"
    },
    "objects": [
        {
            "apiVersion": "v1",
            "kind": "ImageStream",
            "metadata": {
                "labels": {
                    "app": "${NAME}"
                },
                "name": "${NAME}"
            },
            "spec": {}
        },
        {
            "apiVersion": "v1",
            "kind": "BuildConfig",
            "metadata": {
                "labels": {
                    "app": "${NAME}"
                },
                "name": "${NAME}"
            },
            "spec": {
                "output": {
                    "to": {
                        "kind": "ImageStreamTag",
                        "name": "${NAME}:latest"
                    }
                },
                "postCommit": {},
                "resources": {},
                "source": {
                    "git": {
                        "ref": "${SOURCE_REPOSITORY_REF}",
                        "uri": "${SOURCE_REPOSITORY_URL}"
                    },
                    "type": "Git"
                },
                "strategy": {
                    "sourceStrategy": {
                        "env": [
                            {
                                "name": "OUTPUT_DIR",
                                "value": "${OUTPUT_DIR}"
                            },
                            {
                                "name": "YARN_ENABLED",
                                "value": "${YARN_ENABLED}"
                            }
                        ],
                        "from": {
                            "kind": "DockerImage",
                            "name": "registry.redhat.io/rhoar-nodejs-tech-preview/rhoar-nodejs-10-webapp"
                        }
                    },
                    "type": "Source"
                },
                "triggers": [
                    {
                        "github": {
                            "secret": "${GITHUB_WEBHOOK_SECRET}"
                        },
                        "type": "GitHub"
                    },
                    {
                        "type": "ConfigChange"
                    },
                    {
                        "imageChange": {},
                        "type": "ImageChange"
                    }
                ]
            },
            "status": {
                "lastVersion": 0
            }
        },
        {
            "apiVersion": "v1",
            "kind": "DeploymentConfig",
            "metadata": {
                "labels": {
                    "app": "${NAME}"
                },
                "name": "${NAME}"
            },
            "spec": {
                "replicas": 1,
                "selector": {
                    "app": "${NAME}"
                },
                "template": {
                    "metadata": {
                        "labels": {
                            "app": "${NAME}"
                        }
                    },
                    "spec": {
                        "containers": [
                            {
                                "image": "${NAME}:latest",
                                "name": "${NAME}",
                                "ports": [
                                    {
                                        "containerPort": 8080,
                                        "name": "http",
                                        "protocol": "TCP"
                                    }
                                ],
                                "resources": {
                                    "limits": {
                                        "memory": "${MEMORY_LIMIT}"
                                    }
                                },
                                "securityContext": {
                                    "privileged": false
                                }
                            }
                        ]
                    }
                },
                "triggers": [
                    {
                        "type": "ConfigChange"
                    },
                    {
                        "imageChangeParams": {
                            "automatic": true,
                            "containerNames": [
                                "${NAME}"
                            ],
                            "from": {
                                "kind": "ImageStreamTag",
                                "name": "${NAME}:latest"
                            }
                        },
                        "type": "ImageChange"
                    }
                ]
            }
        },
        {
            "apiVersion": "v1",
            "kind": "Service",
            "metadata": {
                "labels": {
                    "app": "${NAME}"
                },
                "name": "${NAME}"
            },
            "spec": {
                "ports": [
                    {
                        "name": "http",
                        "port": 8080
                    }
                ],
                "selector": {
                    "app": "${NAME}"
                }
            }
        },
        {
            "apiVersion": "v1",
            "kind": "Route",
            "metadata": {
                "labels": {
                    "app": "${NAME}"
                },
                "name": "${NAME}"
            },
            "spec": {
                "port": {
                    "targetPort": 8080
                },
                "to": {
                    "kind": "Service",
                    "name": "${NAME}"
                }
            }
        }
    ],
    "parameters": [
        {
            "description": "The name assigned to all of the frontend objects defined in this template.",
            "displayName": "Name",
            "name": "NAME",
            "required": true,
            "value": "react-web-app"
        },
        {
            "description": "The OpenShift Namespace where the ImageStream resides.",
            "displayName": "Namespace",
            "name": "NAMESPACE",
            "required": true,
            "value": "openshift"
        },
        {
            "description": "Maximum amount of memory the container can use.",
            "displayName": "Memory Limit",
            "name": "MEMORY_LIMIT",
            "required": true,
            "value": "512Mi"
        },
        {
            "description": "The source URL for the application",
            "displayName": "Source URL",
            "name": "SOURCE_REPOSITORY_URL",
            "required": true,
            "value": "https://github.com/nodeshift-starters/react-web-app"
        },
        {
            "description": "The branch name for the application",
            "displayName": "Source Branch",
            "name": "SOURCE_REPOSITORY_REF",
            "required": true,
            "value": "master"
        },
        {
            "description": "The location within the source repo of the application",
            "displayName": "Source Directory",
            "name": "SOURCE_REPOSITORY_DIR",
            "required": true,
            "value": "."
        },
        {
            "description": "The location of the compiled static files from your web apps builder",
            "displayName": "Output Directory",
            "name": "OUTPUT_DIR",
            "required": false,
            "value": "build"
        },
        {
            "description": "A flag to enable the use of the Yarn package manager",
            "displayName": "Yarn Enabled",
            "name": "YARN_ENABLED",
            "required": false,
            "value": "true"
        },
        {
            "description": "A secret string used to configure the GitHub webhook.",
            "displayName": "GitHub Webhook Secret",
            "from": "[a-zA-Z0-9]{40}",
            "generate": "expression",
            "name": "GITHUB_WEBHOOK_SECRET",
            "required": true
        }
    ]
}