apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: opendj
spec:
  serviceName: opendj
  replicas: 1
  selector:
    matchLabels:
      app: opendj
  volumeClaimTemplates: []
  template:
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app
                    operator: In
                    values:
                      - opendj
              topologyKey: "kubernetes.io/hostname"
      containers:
      - name: opendj
        imagePullPolicy: Always
        image: gluufederation/wrends:4.0.0
        envFrom:
        - configMapRef:
            name: opendj-cm
        ports:
          - containerPort: 1636
            name: ldaps
          - containerPort: 1389
            name: ldap
          - containerPort: 8989
            name: replication
          - containerPort: 4444
            name: admin
        volumeMounts:
          - mountPath: /opt/opendj/config
            name: opendj-pvc
            subPath: config
          - mountPath: /opt/opendj/ldif
            name: opendj-pvc
            subPath: ldif
          - mountPath: /opt/opendj/logs
            name: opendj-pvc
            subPath: logs
          - mountPath: /opt/opendj/db
            name: opendj-pvc
            subPath: db
          - mountPath: /flag
            name: opendj-pvc
            subPath: flag
        readinessProbe:
          tcpSocket:
            port: 1636
          initialDelaySeconds: 25
          periodSeconds: 25
        livenessProbe:
          tcpSocket:
            port: 1636
          initialDelaySeconds: 30
          periodSeconds: 30