apiVersion: v1
kind: Pod
metadata:
  annotations:
    com.octoperf/description: "${KRAKEN_DESCRIPTION}"
    com.octoperf/expectedCount: "${KRAKEN_EXPECTED_COUNT}"
  labels:
    com.octoperf/taskType: "${KRAKEN_TASK_TYPE}"
    com.octoperf/hostId: "${KRAKEN_HOST_ID}"
    com.octoperf/taskId: "${KRAKEN_TASK_ID}"
    com.octoperf/applicationId: "${KRAKEN_APPLICATION_ID}"
    com.octoperf/projectId: "${KRAKEN_PROJECT_ID}"
    com.octoperf/userId: "${KRAKEN_USER_ID}"
  name: "${KRAKEN_APPLICATION_ID}-${KRAKEN_PROJECT_ID}-${KRAKEN_TASK_ID}-${KRAKEN_HOST_ID}"
spec:
  containers:
    -
      image: "octoperf/kraken-gatling-runner:${KRAKEN_VERSION}"
      name: "${KRAKEN_APPLICATION_ID}-${KRAKEN_PROJECT_ID}-${KRAKEN_TASK_ID}-${KRAKEN_HOST_ID}-${KRAKEN_GATLING_CONTAINER_NAME}"
      resources:
        limits:
          cpu: "${KRAKEN_GATLING_CPU_LIMIT}"
          memory: "${KRAKEN_GATLING_MEMORY_LIMIT}"
        requests:
          cpu: "${KRAKEN_GATLING_CPU_REQUEST}"
          memory: "${KRAKEN_GATLING_MEMORY_REQUEST}"
      env:
        - name: JAVA_OPTS
          value: "-Dspring.profiles.active=kubernetes -Xmx${KRAKEN_GATLING_XMX}"
        - name: KRAKEN_CONTAINER_TASKID
          value: "${KRAKEN_TASK_ID}"
        - name: KRAKEN_CONTAINER_TASKTYPE
          value: "${KRAKEN_TASK_TYPE}"
        - name: KRAKEN_CONTAINER_HOSTID
          value: "${KRAKEN_HOST_ID}"
        - name: KRAKEN_CONTAINER_USERID
          value: "${KRAKEN_USER_ID}"
        - name: KRAKEN_CONTAINER_APPLICATIONID
          value: "${KRAKEN_APPLICATION_ID}"
        - name: KRAKEN_CONTAINER_PROJECTID
          value: "${KRAKEN_PROJECT_ID}"
        - name: KRAKEN_CONTAINER_NAME
          value: "${KRAKEN_APPLICATION_ID}-${KRAKEN_PROJECT_ID}-${KRAKEN_TASK_ID}-${KRAKEN_HOST_ID}-${KRAKEN_GATLING_CONTAINER_NAME}"
        - name: KRAKEN_CONTAINER_LABEL
          value: "${KRAKEN_GATLING_CONTAINER_LABEL}"
        - name: KRAKEN_GATLING_JAVAOPTS
          value: "${KRAKEN_GATLING_JAVA_OPTS} -Xmx${KRAKEN_GATLING_XMX}"
        - name: KRAKEN_BACKEND_URL
          value: "${KRAKEN_BACKEND_URL}"
        - name: KRAKEN_GATLING_SIMULATION_NAME
          value: "${KRAKEN_GATLING_SIMULATION_NAME}"
        - name: KRAKEN_GATLING_DESCRIPTION
          value: "${KRAKEN_DESCRIPTION}"
        - name: KRAKEN_SECURITY_URL
          value: "${KRAKEN_SECURITY_URL}"
        - name: KRAKEN_SECURITY_WEB_ID
          value: "${KRAKEN_SECURITY_WEB_ID}"
        - name: KRAKEN_SECURITY_CONTAINER_ID
          value: "${KRAKEN_SECURITY_CONTAINER_ID}"
        - name: KRAKEN_SECURITY_CONTAINER_SECRET
          value: "${KRAKEN_SECURITY_CONTAINER_SECRET}"
        - name: KRAKEN_SECURITY_REALM
          value: "${KRAKEN_SECURITY_REALM}"
        - name: KRAKEN_SECURITY_ACCESSTOKEN
          value: "${KRAKEN_SECURITY_ACCESS_TOKEN}"
        - name: KRAKEN_SECURITY_REFRESHTOKEN
          value: "${KRAKEN_SECURITY_REFRESH_TOKEN}"
        - name: KRAKEN_SECURITY_EXPIRESIN
          value: "${KRAKEN_SECURITY_EXPIRES_IN}"
        - name: KRAKEN_SECURITY_REFRESHEXPIRESIN
          value: "${KRAKEN_SECURITY_REFRESH_EXPIRES_IN}"
        - name: KRAKEN_GATLING_SCENARIO_CUSTOM_SETUP
          value: "${KRAKEN_GATLING_SCENARIO_CUSTOM_SETUP}"
        - name: KRAKEN_GATLING_SCENARIO_CONCURRENT_USERS
          value: "${KRAKEN_GATLING_SCENARIO_CONCURRENT_USERS}"
        - name: KRAKEN_GATLING_SCENARIO_RAMP_UP_DURATION
          value: "${KRAKEN_GATLING_SCENARIO_RAMP_UP_DURATION}"
        - name: KRAKEN_GATLING_SCENARIO_PEAK_DURATION
          value: "${KRAKEN_GATLING_SCENARIO_PEAK_DURATION}"
    -
      image: "octoperf/kraken-telegraf:${KRAKEN_VERSION}"
      name: "${KRAKEN_APPLICATION_ID}-${KRAKEN_PROJECT_ID}-${KRAKEN_TASK_ID}-${KRAKEN_HOST_ID}-${KRAKEN_GATLING_SIDEKICK_NAME}"
      resources:
        limits:
          cpu: "${KRAKEN_SIDEKICK_CPU_LIMIT}"
          memory: "${KRAKEN_SIDEKICK_MEMORY_LIMIT}"
        requests:
          cpu: "${KRAKEN_SIDEKICK_CPU_REQUEST}"
          memory: "${KRAKEN_SIDEKICK_MEMORY_REQUEST}"
      env:
        - name: JAVA_OPTS
          value: "-Dspring.profiles.active=kubernetes"
        - name: KRAKEN_CONTAINER_TASKID
          value: "${KRAKEN_TASK_ID}"
        - name: KRAKEN_CONTAINER_TASKTYPE
          value: "${KRAKEN_TASK_TYPE}"
        - name: KRAKEN_CONTAINER_HOSTID
          value: "${KRAKEN_HOST_ID}"
        - name: KRAKEN_CONTAINER_USERID
          value: "${KRAKEN_USER_ID}"
        - name: KRAKEN_CONTAINER_APPLICATIONID
          value: "${KRAKEN_APPLICATION_ID}"
        - name: KRAKEN_CONTAINER_PROJECTID
          value: "${KRAKEN_PROJECT_ID}"
        - name: KRAKEN_CONTAINER_NAME
          value: "${KRAKEN_APPLICATION_ID}-${KRAKEN_PROJECT_ID}-${KRAKEN_TASK_ID}-${KRAKEN_HOST_ID}-${KRAKEN_GATLING_SIDEKICK_NAME}"
        - name: KRAKEN_CONTAINER_LABEL
          value: "${KRAKEN_GATLING_SIDEKICK_LABEL}"
        - name: KRAKEN_INFLUXDB_URL
          value: "${KRAKEN_INFLUXDB_URL}"
        - name: KRAKEN_INFLUXDB_DATABASE
          value: "${KRAKEN_INFLUXDB_DATABASE}"
        - name: KRAKEN_INFLUXDB_USER
          value: "${KRAKEN_INFLUXDB_USER}"
        - name: KRAKEN_INFLUXDB_PASSWORD
          value: "${KRAKEN_INFLUXDB_PASSWORD}"
        - name: KRAKEN_BACKEND_URL
          value: "${KRAKEN_BACKEND_URL}"
        - name: KRAKEN_SECURITY_URL
          value: "${KRAKEN_SECURITY_URL}"
        - name: KRAKEN_SECURITY_WEB_ID
          value: "${KRAKEN_SECURITY_WEB_ID}"
        - name: KRAKEN_SECURITY_CONTAINER_ID
          value: "${KRAKEN_SECURITY_CONTAINER_ID}"
        - name: KRAKEN_SECURITY_CONTAINER_SECRET
          value: "${KRAKEN_SECURITY_CONTAINER_SECRET}"
        - name: KRAKEN_SECURITY_REALM
          value: "${KRAKEN_SECURITY_REALM}"
        - name: KRAKEN_SECURITY_ACCESSTOKEN
          value: "${KRAKEN_SECURITY_ACCESS_TOKEN}"
        - name: KRAKEN_SECURITY_REFRESHTOKEN
          value: "${KRAKEN_SECURITY_REFRESH_TOKEN}"
        - name: KRAKEN_SECURITY_EXPIRESIN
          value: "${KRAKEN_SECURITY_EXPIRES_IN}"
        - name: KRAKEN_SECURITY_REFRESHEXPIRESIN
          value: "${KRAKEN_SECURITY_REFRESH_EXPIRES_IN}"
  hostAliases:
    - hostnames:
        - "kraken-gatling-telegraf"
      ip: "127.0.0.1"
    - hostnames:
        - "${KRAKEN_HOSTNAME}"
      ip: "${KRAKEN_IP}"
  nodeSelector:
    com.octoperf/hostId: "${KRAKEN_HOST_ID}"
  restartPolicy: Never
  terminationGracePeriodSeconds: 5
