---
kind: Template
apiVersion: v1
metadata:
  name: "${NAME}-deployment-template"
objects:
- kind: Service
  apiVersion: v1
  metadata:
    name: "${NAME}"
    annotations:
      description: Exposes and load balances the application pods.
  spec:
    ports:
    - name: 5001-tcp
      port: 5001
      targetPort: 5001
    selector:
      name: "${NAME}"
- kind: DeploymentConfig
  apiVersion: v1
  metadata:
    name: "${NAME}"
    annotations:
      description: Defines how to deploy the application server.
  spec:
    strategy:
      type: Rolling
    triggers:
    - type: ImageChange
      imageChangeParams:
        automatic: true
        containerNames:
        - "${NAME}"
        from:
          kind: ImageStreamTag
          namespace: "${IMAGE_NAMESPACE}"
          name: "${SOURCE_IMAGE_NAME}:${TAG_NAME}"
    - type: ConfigChange
    replicas: 1
    selector:
      name: "${NAME}"
    template:
      metadata:
        name: "${NAME}"
        labels:
          name: "${NAME}"
      spec:
        containers:
        - name: "${NAME}"
          image: " "
          ports:
          - containerPort: 5001
            protocol: TCP
          readinessProbe:
            timeoutSeconds: 3
            initialDelaySeconds: 3
            httpGet:
              path: "/health"
              port: 5001
          livenessProbe:
            timeoutSeconds: 30
            initialDelaySeconds: 120
            periodSeconds: 60
            httpGet:
              path: "/health"
              port: 5001
          resources:
            requests:
              cpu: "${CPU_REQUEST}"
              memory: "${MEMORY_REQUEST}"
            limits:
              cpu: "${CPU_LIMIT}"
              memory: "${MEMORY_LIMIT}"
parameters:
- name: NAME
  displayName: Name
  description: The name assigned to all of the OpenShift resources associated to the
    server instance.
  required: true
  value: weasyprint
- name: SOURCE_IMAGE_NAME
  displayName: Source Image Name
  description: The name of the image to use for this resource.
  required: true
  value: weasyprint
- name: IMAGE_NAMESPACE
  displayName: Image Namespace
  required: true
  description: The namespace of the OpenShift project containing the imagestream for
    the application.
  value: jag-csb-edivorce-tools
- name: TAG_NAME
  displayName: Environment TAG name
  description: The TAG name for this environment, e.g., dev, test, prod
  required: true
  value: dev
- name: CPU_LIMIT
  displayName: Resources CPU Limit
  description: The resources CPU limit (in cores) for this build.
  required: true
  value: '2'
- name: MEMORY_LIMIT
  displayName: Resources Memory Limit
  description: The resources Memory limit (in Mi, Gi, etc) for this build.
  required: true
  value: 1Gi
- name: CPU_REQUEST
  displayName: Resources CPU Request
  description: The resources CPU request (in cores) for this build.
  required: true
  value: 250m
- name: MEMORY_REQUEST
  displayName: Resources Memory Request
  description: The resources Memory request (in Mi, Gi, etc) for this build.
  required: true
  value: 512Mi
