#
# ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL
#
# Copyright © 2016-2019 ThingsBoard, Inc. All Rights Reserved.
#
# NOTICE: All information contained herein is, and remains
# the property of ThingsBoard, Inc. and its suppliers,
# if any.  The intellectual and technical concepts contained
# herein are proprietary to ThingsBoard, Inc.
# and its suppliers and may be covered by U.S. and Foreign Patents,
# patents in process, and are protected by trade secret or copyright law.
#
# Dissemination of this information or reproduction of this material is strictly forbidden
# unless prior written permission is obtained from COMPANY.
#
# Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees,
# managers or contractors who have executed Confidentiality and Non-disclosure agreements
# explicitly covering such access.
#
# The copyright notice above does not evidence any actual or intended publication
# or disclosure  of  this source code, which includes
# information that is confidential and/or proprietary, and is a trade secret, of  COMPANY.
# ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC  PERFORMANCE,
# OR PUBLIC DISPLAY OF OR THROUGH USE  OF THIS  SOURCE CODE  WITHOUT
# THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED,
# AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES.
# THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION
# DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS,
# OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT  MAY DESCRIBE, IN WHOLE OR IN PART.
#

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: tb-performance-run
  namespace: thingsboard
  labels:
    app: tb-performance-run
spec:
  serviceName: tb-performance-run
  replicas: 20
  podManagementPolicy: "Parallel"
  selector:
    matchLabels:
      app: tb-performance-run
  template:
    metadata:
      labels:
        app: tb-performance-run
    spec:
      nodeSelector:
        nodeType: tb-performance
      imagePullSecrets:
        - name: regcred
      securityContext:
        sysctls:
        - name: net.ipv4.ip_local_port_range
          value: "10000 61000"
        - name: net.ipv4.tcp_fin_timeout
          value: "30"
      containers:
      - name: tb-performance
        imagePullPolicy: Always
        image: thingsboard/tb-performance-test:latest
        resources:
          requests:
            cpu: "1500m"
            memory: 3Gi
        env:
        - name: TEST_ENABLED
          value: "true"
        - name: TEST_API
          value: "device"
        - name: MESSAGES_PER_SECOND
          value: "1000"
        - name: DURATION_IN_SECONDS
          value: "14400"
        - name: USE_INSTANCE_IDX
          value: "true"
        - name: USE_INSTANCE_IDX_REGEX
          value: "true"
        - name: INSTANCE_IDX_REGEX
          value: "([0-9]+)$"
        - name: INSTANCE_IDX_REGEX_SOURCE
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: DEVICE_COUNT
          value: "50000"
        - name: GATEWAY_COUNT
          value: "0"
        - name: DEVICE_CREATE_ON_START
          value: "false"
        - name: DEVICE_DELETE_ON_COMPLETE
          value: "false"
        - name: GATEWAY_CREATE_ON_START
          value: "false"
        - name: GATEWAY_DELETE_ON_COMPLETE
          value: "false"
        - name: ALARM_STORM_START_SECOND
          value: "60"
        - name: ALARM_STORM_END_SECOND
          value: "360"
        - name: ALARMS_PER_SECOND
          value: "10"
        - name: WARMUP_ENABLED
          value: "false"
        - name: DASHBOARD_CREATE_ON_START
          value: "false"
        - name: CUSTOMER_CREATE_ON_START
          value: "false"
        - name: CUSTOMER_END_IDX
          value: "0"
        - name: UPDATE_ROOT_RULE_CHAIN
          value: "false"
        - name: REVERT_ROOT_RULE_CHAIN
          value: "false"
        envFrom:
        - configMapRef:
            name: tb-performance-config
