apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: db
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      service: db
  template:
    metadata:
      labels:
        service: db
    spec:
      containers:
      - name: postgres
        image: postgres
        env:
          - name: POSTGRES_PASSWORD
            value: password
        ports:
        - containerPort: 5432

---

apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  type: NodePort
  ports:
  - port: 5432
    protocol: TCP
  selector:
    service: db

---

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: api
  name: api
spec:
  replicas: 1
  selector:
    matchLabels:
      service: api
  template:
    metadata:
      labels:
        service: api
    spec:
      containers:
      - name: api
        image: mozilla/tls-observatory
        imagePullPolicy: IfNotPresent
        command:
          - /app/tlsobs-api
        env:
          - name: TLSOBS_POSTGRES
            value: postgres
          - name: TLSOBS_POSTGRESUSER
            value: tlsobsapi
          - name: TLSOBS_POSTGRESPASS
            value: mysecretpassphrase
        ports:
        - containerPort: 8083

---

apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  type: NodePort
  ports:
  - port: 8083
    protocol: TCP
  selector:
    service: api

---

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: scanner
  name: scanner
spec:
  replicas: 1
  selector:
    matchLabels:
      service: scanner
  template:
    metadata:
      labels:
        service: scanner
    spec:
      containers:
      - name: scanner
        image: mozilla/tls-observatory
        imagePullPolicy: IfNotPresent
        command:
          - /app/tlsobs-scanner
        env:
          - name: TLSOBS_POSTGRES
            value: postgres
          - name: TLSOBS_POSTGRESUSER
            value: tlsobsscanner
          - name: TLSOBS_POSTGRESPASS
            value: mysecretpassphrase
