apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rmqbroker
  labels:
    app: rmqbroker

spec:
  serviceName: rmqbroker
  replicas: 1
  selector:
    matchLabels:
      app: rmqbroker
  template:
    metadata:
      labels:
        app: rmqbroker
    spec:
      containers:
        - name: rmqbroker
          image: registry.cn-hangzhou.aliyuncs.com/sre_pub/rocketmq:broker
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              cpu: 440m
              memory: 2000Mi
            requests:
              cpu: 400m
              memory: 2000Mi
          env:
            - name: TZ
              value: Asia/Shanghai
            - name: JAVA_OPT_EXT
              value:  -Duser.home=/opt -server -Xms1700m -Xmx1700m
          command: ["/bin/bash","mqbroker","-c","/etc/rocketmq/broker.conf","-n","rocketmq:9876","autoCreateTopicEnable=true"]
          ports:
            - containerPort: 10909
            - containerPort: 10911
            - containerPort: 10912
          volumeMounts:
            #            - name: vol-logs
            #              mountPath: /opt/logs
            - name: vol-store
              mountPath: /opt/store
            - name: vol-broker-config
              mountPath: /etc/rocketmq
      #      volumes:
      #        - name: vol-logs
      #          hostPath:
      #            path: /www/k8s/foxdev/rocketmq/logs-b
      #            type: Directory
      #        - name: vol-store
      #          hostPath:
      #              path: /www/k8s/foxdev/rocketmq/store-b
      #              type: Directory
      #        - name: vol-broker
      #          hostPath:
      #            path: /www/k8s/foxdev/rocketmq/conf/broker.conf
      #            type: File
      volumes:
        - name: vol-broker-config
          configMap:
            name: broker-config
  volumeClaimTemplates:
    - metadata:
        name: vol-store
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 18Gi
#        volumeName:
#        storageClassName: nfs