apiVersion: v1
kind: Service
metadata:
  name: activemq-cluster
  namespace: {{ .Values.namespace }}
spec:
  selector:
    app: activemq
  ports:
  - name: external-port
    port: 8161
    targetPort: 8161
  - name: internal-port
    port: 61616
    protocol: TCP
    targetPort: 61616
  type: LoadBalancer

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: activemq-cluster
  namespace: {{ .Values.namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: activemq
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: activemq
    spec:
      containers:
        - image: {{ .Values.activemq.image }}
          imagePullPolicy: IfNotPresent
          name: activemq
          ports:
            - containerPort: 61616
            - containerPort: 8161
          env:
            - name: ACTIVEMQ_CONFIG_MINMEMORY
              value: "512"
            - name: ACTIVEMQ_CONFIG_MAXMEMORY
              value: "1024"
          livenessProbe:
            httpGet:
              path: /
              port: 8161
            initialDelaySeconds: 45
            timeoutSeconds: 10
            periodSeconds: 60
            failureThreshold: 3

