apiVersion: apps/v1
kind: Deployment
metadata:
  name: autostress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: autostress
  template:
    metadata:
      labels:
        app: autostress
    spec:
      containers:
      - name: autostress
        image: registry.edoc2.com:5000/edoc2v5/autostress:latest
        #当前pod一直重启,无法成功启动时,打开此注释,以特权模式启动 
        #ecurityContext:
        #  privileged: true
        ports:
        - containerPort: 8080
        - containerPort: 18080
        volumeMounts:
        - name: test
          mountPath: /opt/test
        - name: jenkins-home
          mountPath: /var/jenkins_home
        - name: prometheus
          mountPath: /opt/prometheus
        - name: consul
          mountPath: /opt/consul
        env:
        - name: TZ
          value: "Asia/Shanghai"
        - name: HOST_IP
          value: "192.168.251.86"    #物理机IP地址
        - name: Product
          value: "ECM"    #将ECM替换为要测试的产品
        - name: Version
          value: "v6.6.0.0"    #将v6.0.0.0替换为要测试的版本
      volumes:
      - name: test
        hostPath:
          path: /data/test    #物理机挂载目录
      - name: jenkins-home
        hostPath:
          path: /data/jenkins_home    #物理机挂载目录
      - name: prometheus
        hostPath:
          path: /data/prometheus    #物理机挂载目录
      - name: consul
        hostPath:
          path: /data/consul    #物理机挂载目录

---
apiVersion: v1
kind: Service
metadata:
  name: autostress
spec:
  selector:
    app: autostress
  ports:
    - name: jenkins-8080
      protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 30080    #压测工具入口端口
    - name: report-18080
      protocol: TCP
      port: 18080
      targetPort: 18080
      nodePort: 31080    #查看测试报告端口
    - name: monitor-3000
      protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 33000    #监控面板端口
    - name: prometheus-9090
      protocol: TCP
      port: 9090
      targetPort: 9090
      nodePort: 39090    #Prometheus端口
    - name: consul-8500
      protocol: TCP
      port: 8500
      targetPort: 8500
      nodePort: 38500    #服务器注册中心端口
  type: NodePort
