apiVersion: template.openshift.io/v1
kind: Template
labels:
  template: test-2
message: |-
  The following service(s) have been created in your project: ${NAME}.

  For more information about using this template, including OpenShift considerations, view the Documentation.
metadata:
  annotations:
    description: test
    iconClass: icon-openshift
    openshift.io/display-name: Test
    openshift.io/long-description: Test
    tags: quickstart
  name: test-2
objects:
  - apiVersion: v1
    kind: Service
    metadata:
      annotations:
        description: Exposes and load balances the application pods
        openshift.io/generated-by: OpenShiftWebConsole
      labels:
        app: ${NAME}
        template: test-2
      name: ${NAME}
    spec:
      ports:
        - name: web
          port: 8080
          targetPort: 8080
      selector:
        name: ${NAME}
  - apiVersion: v1
    kind: BuildConfig
    metadata:
      annotations:
        description: Defines how to build the application
        openshift.io/generated-by: OpenShiftWebConsole
      labels:
        app: ${NAME}
        template: test-2
        app.kubernetes.io/instance: ${NAME}
      name: ${NAME}
    spec:
      output:
        to:
          kind: ImageStreamTag
          name: ${NAME}:latest
      resources:
        limits:
          ephemeral-storage: 8Gi
          memory: 2Gi
        requests:
          cpu: 200m
          memory: 512Mi
      source:
        contextDir: ${CONTEXT_DIR}
        git:
          ref: ${SOURCE_REPOSITORY_REF}
          uri: ${SOURCE_REPOSITORY_URL}
        type: Git
      strategy:
        sourceStrategy:
          env:
            - name: FOO
              value: "bar"
          from:
            kind: ImageStreamTag
            namespace: openshift
            name: "nodejs:12-ubi7"
        type: Source
      successfulBuildsHistoryLimit: 2
      failedBuildsHistoryLimit: 2
      completionDeadlineSeconds: 1800
      triggers:
        - type: ImageChange
        - type: ConfigChange
  - apiVersion: v1
    kind: ImageStream
    metadata:
      annotations:
        description: Keeps track of changes in the application image
        openshift.io/generated-by: OpenShiftWebConsole
      name: ${NAME}
      labels:
        app: ${NAME}
        template: test-2
  - apiVersion: v1
    kind: DeploymentConfig
    metadata:
      annotations:
        description: Defines how to deploy the application server
        openshift.io/generated-by: OpenShiftWebConsole
      labels:
        app: ${NAME}
        template: test-2
      name: ${NAME}
    spec:
      replicas: 1
      selector:
        name: ${NAME}
      strategy:
        type: Rolling
      template:
        metadata:
          labels:
            name: ${NAME}
          name: ${NAME}
        spec:
          containers:
            - image: " "
              name: ${NAME}
              ports:
                - containerPort: 8080
              resources:
                limits:
                  memory: ${LRAM}
                requests:
                  cpu: ${RCPU}
                  memory: ${RRAM}
      triggers:
        - imageChangeParams:
            automatic: true
            containerNames:
              - ${NAME}
            from:
              kind: ImageStreamTag
              name: ${NAME}:latest
          type: ImageChange
        - type: ConfigChange
parameters:
  - description: The name assigned to all of the frontend objects defined in this template.
    displayName: Name
    name: NAME
    required: true
    value: test-app
  - description: The URL of the repository with your application source code.
    displayName: Git Repository URL
    name: SOURCE_REPOSITORY_URL
    required: true
    value: https://github.com/nodeshift-starters/react-web-app
  - description:
      Set this to a branch name, tag or other ref of your repository if you
      are not using the default branch.
    displayName: Git Reference
    name: SOURCE_REPOSITORY_REF
  - 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
  - description:
      Set this to the relative path to your project if it is not in the root
      of your repository.
    displayName: Context Directory
    name: CONTEXT_DIR
  - description: The amount of RAM this app is limited to (format 100Mi)
    displayName: RAM Limit
    name: LRAM
    required: true
    value: 2Gi
  - description:
      The number of CPU milicores this app requests as a minimum to run (format
      100m, Min 100m)
    displayName: CPU Request
    name: RCPU
    required: true
    value: "200m"
  - description: The amount of RAM this app requests as a minimum to run (format 100Mi)
    displayName: RAM Request
    name: RRAM
    required: true
    value: 500Mi
