apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: wildfly
  name: wildfly
  namespace: stomp-test
  annotations:
    #reloader.stakater.com/auto: "true"
    configmap.reloader.stakater.com/reload: stomp-test-config
spec:
  replicas: 0
  minReadySeconds: 90
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      deployment: wildfly
      app: wildfly
  template:
    metadata:
      labels:
        deployment: wildfly
        app: wildfly
    spec:
      serviceAccountName: jgroups-kubeping-service-account
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - topologyKey: "kubernetes.io/hostname"
            labelSelector:
              matchLabels:
                app: wildfly
      containers:
      - name: wildfly
        image: registry.x1/j7beck/x1-wildfly-stomp-test:1.6
        imagePullPolicy: Always
        env:
        - name: DB_SERVER
          value: postgresql
        - name: DB_USER
          valueFrom:
            secretKeyRef:
              key: database-user
              name: postgresql
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              key: database-password
              name: postgresql
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: JAEGER_SERVICE_NAME
          value: stomp-test
        - name: MP_METRICS_TAGS
          value: "_app=stomp-test,version=1.6"
        resources:
          limits:
            memory: "1024Mi"
          requests:
            memory: "768Mi"
        ports:
        - containerPort: 8080
          protocol: TCP
        - containerPort: 8443
          protocol: TCP
        volumeMounts:
        - name: pki-secret
          mountPath: /var/run/x1
          readOnly: true
        - name: application-config
          mountPath: /srv/wildfly/configuration/application
          readOnly: true
        - name: log
          mountPath: /srv/wildfly/log
          readOnly: false
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /health/ready
            port: 9990
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 10
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /health/live
            port: 9990
            scheme: HTTP
          initialDelaySeconds: 120
          periodSeconds: 60
          successThreshold: 1
          timeoutSeconds: 10
      - name: filebeat
        image: registry.x1/j7beck/x1-filebeat-wildfly
        imagePullPolicy: Always
        volumeMounts:
        - name: pki-secret
          mountPath: /var/run/x1
          readOnly: true
        - name: log
          mountPath: /var/log/wildfly
        env:
        - name: SERVICE_ELASTICSEARCH
          value: elasticsearch.x1
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
      - name: pki-secret
        secret:
          secretName: pki-wildfly-secret
      - name: log
        emptyDir: {}
      - name: application-config
        configMap:
          name: stomp-test-config  
