---
apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: mongo
  name: mongo
spec:
  ports:
    - name: "27017"
      port: 27017
      targetPort: 27017
  selector:
    io.kompose.service: mongo

---
apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  ports:
    - name: "3306"
      port: 3306
      targetPort: 3306
  selector:
    io.kompose.service: mysql

---
apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: postgresql
  name: postgresql
spec:
  ports:
    - name: "5432"
      port: 5432
      targetPort: 5432
  selector:
    io.kompose.service: postgresql

---
apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: redis
  name: redis
spec:
  ports:
    - name: "6379"
      port: 6379
      targetPort: 6379
  selector:
    io.kompose.service: redis

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: mongo
  name: mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: mongo
  template:
    metadata:
      labels:
        io.kompose.service: mongo
    spec:
      containers:
        - image: mongo
          livenessProbe:
            failureThreshold: 5
            periodSeconds: 10
            tcpSocket:
              port: 8080
            timeoutSeconds: 1
          name: mongo
          ports:
            - containerPort: 27017
              protocol: TCP
          readinessProbe:
            failureThreshold: 5
            periodSeconds: 10
            tcpSocket:
              port: 9090
            timeoutSeconds: 1
      restartPolicy: Always

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: mysql
  template:
    metadata:
      labels:
        io.kompose.service: mysql
    spec:
      containers:
        - image: mysql
          livenessProbe:
            failureThreshold: 6
            periodSeconds: 11
            tcpSocket:
              port: 8081
            timeoutSeconds: 2
          name: mysql
          ports:
            - containerPort: 3306
              protocol: TCP
          readinessProbe:
            failureThreshold: 6
            periodSeconds: 11
            tcpSocket:
              port: 9091
            timeoutSeconds: 2
      restartPolicy: Always

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: postgresql
  name: postgresql
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: postgresql
  template:
    metadata:
      labels:
        io.kompose.service: postgresql
    spec:
      containers:
        - image: postgresql
          livenessProbe:
            failureThreshold: 5
            httpGet:
              path: /health
              port: 8080
            periodSeconds: 10
            timeoutSeconds: 1
          name: postgresql
          ports:
            - containerPort: 5432
              protocol: TCP
          readinessProbe:
            failureThreshold: 5
            httpGet:
              path: /ready
              port: 8080
            periodSeconds: 10
            timeoutSeconds: 1
      restartPolicy: Always

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: redis
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: redis
  template:
    metadata:
      labels:
        io.kompose.service: redis
    spec:
      containers:
        - image: redis
          livenessProbe:
            exec:
              command:
                - echo "liveness"
            failureThreshold: 5
            periodSeconds: 10
            timeoutSeconds: 1
          name: redis
          ports:
            - containerPort: 6379
              protocol: TCP
          readinessProbe:
            exec:
              command:
                - echo
                - liveness
            failureThreshold: 5
            periodSeconds: 10
            timeoutSeconds: 1
      restartPolicy: Always

