---
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: v1
kind: Service
metadata:
  labels:
    io.kompose.service: web
  name: web
spec:
  ports:
    - name: "5000"
      port: 5000
      targetPort: 5000
  selector:
    io.kompose.service: web

---
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:3.0
          name: redis
          ports:
            - containerPort: 6379
              protocol: TCP
      restartPolicy: Always

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: web
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: web
  template:
    metadata:
      labels:
        io.kompose.service: web
    spec:
      containers:
        - image: tuna/docker-counter23
          name: web
          ports:
            - containerPort: 5000
              protocol: TCP
      restartPolicy: Always

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  labels:
    io.kompose.service: web
  name: web
spec:
  ingressClassName: nginx
  rules:
    - host: batman.example.com
      http:
        paths:
          - backend:
              service:
                name: web
                port:
                  number: 5000
            path: /dev
            pathType: Prefix
    - host: batwoman.example.com
      http:
        paths:
          - backend:
              service:
                name: web
                port:
                  number: 5000
            path: /
            pathType: Prefix
  tls:
    - hosts:
        - batman.example.com
        - batwoman.example.com
      secretName: test-secret

