apiVersion: v1
kind: Pod
metadata:
  labels:
    app: atst-debugger
  name: atst-debugger-v1
  namespace: atat
spec:
  securityContext:
    fsGroup: 101
  containers:
    - name: atst
      image: registry.atat.codes:443/atst-prod:6329f8e
      args: ["/bin/bash", "-c", "while true; do date; sleep 45; done"]
      envFrom:
      - configMapRef:
          name: atst-envvars
      volumeMounts:
        - name: atst-config
          mountPath: "/opt/atat/atst/atst-overrides.ini"
          subPath: atst-overrides.ini
        - name: nginx-client-ca-bundle
          mountPath: "/opt/atat/atst/ssl/server-certs/ca-chain.pem"
          subPath: client-ca-bundle.pem
        - name: uwsgi-config
          mountPath: "/opt/atat/atst/uwsgi-config.ini"
          subPath: uwsgi-config.ini
        - name: uwsgi-socket-dir
          mountPath: "/var/run/uwsgi"
    - name: atst-nginx
      image: nginx:alpine
      ports:
        - containerPort: 8442
          name: http
        - containerPort: 8443
          name: https
      volumeMounts:
        - name: nginx-auth-tls
          mountPath: "/etc/ssl/private"
        - name: nginx-client-ca-bundle
          mountPath: "/etc/ssl/client-ca-bundle.pem"
          subPath: client-ca-bundle.pem
        - name: nginx-config
          mountPath: "/etc/nginx/conf.d/atst.conf"
          subPath: atst.conf
        - name: nginx-dhparam
          mountPath: "/etc/ssl/dhparam.pem"
          subPath: dhparam.pem
        - name: nginx-htpasswd
          mountPath: "/etc/nginx/.htpasswd"
          subPath: .htpasswd
        - name: uwsgi-socket-dir
          mountPath: "/var/run/uwsgi"
  imagePullSecrets:
    - name: regcred
  volumes:
    - name: atst-config
      secret:
        secretName: atst-config-ini
        items:
        - key: override.ini
          path: atst-overrides.ini
          mode: 0644
    - name: nginx-auth-tls
      secret:
        secretName: auth-atst-ingress-tls
        items:
        - key: tls.crt
          path: auth.atat.crt
          mode: 0644
        - key: tls.key
          path: auth.atat.key
          mode: 0640
    - name: nginx-client-ca-bundle
      secret:
        secretName: nginx-client-ca-bundle
        items:
        - key: client-ca-bundle.pem
          path: client-ca-bundle.pem
          mode: 0666
    - name: nginx-config
      configMap:
        name: atst-nginx
        items:
        - key: nginx-config
          path: atst.conf
    - name: nginx-dhparam
      secret:
        secretName: dhparam-4096
        items:
        - key: dhparam.pem
          path: dhparam.pem
          mode: 0640
    - name: nginx-htpasswd
      secret:
        secretName: atst-nginx-htpasswd
        items:
        - key: htpasswd
          path: .htpasswd
          mode: 0640
    - name: uwsgi-config
      configMap:
        name: atst-config
        items:
        - key: uwsgi-config
          path: uwsgi-config.ini
          mode: 0644
    - name: uwsgi-socket-dir
      emptyDir:
        medium: Memory
  restartPolicy: Never
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: atst-debugger
  name: atst-debugger
  namespace: atat
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8442
  selector:
    app: atst-debugger
