apiVersion: apps/v1
kind: Deployment
metadata:
  name: opa
  labels:
    app: opa
spec:
  replicas: 1
  selector:
    matchLabels:
      app: opa
  template:
    metadata:
      labels:
        app: opa
    spec:
      containers:
        - name: opa
          image: openpolicyagent/opa:latest
          args:
            - "run"
            - "--server"
            - "--addr=0.0.0.0:8181"
            - "--log-level=info"
          ports:
            - containerPort: 8181
              name: http
---
apiVersion: v1
kind: Service
metadata:
  name: opa
  labels:
    app: opa
spec:
  selector:
    app: opa
  ports:
    - protocol: TCP
      port: 80
      targetPort: http
      name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: opa-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  tls:
    - hosts:
        - opa.test.waltid.cloud
      secretName: opa-tls-secret
  rules:
    - host: opa.test.waltid.cloud
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: opa
                port:
                  name: http