# Replication control to run nginx-ssl-proxy
#
# From https://github.com/GoogleCloudPlatform/kube-jenkins-imager/blob/master/ssl_proxy.yaml
# See license/kube_jenkins_imager_license.txt

kind: ReplicationController
apiVersion: v1
metadata:
  name: nginx-ssl-proxy
  labels:
    name: nginx-ssl-proxy
    role: ssl-proxy
spec:
  replicas: 1
  selector:
    name: nginx-ssl-proxy
    role: ssl-proxy
  template:
    metadata:
      name: nginx-ssl-proxy
      labels:
        name: nginx-ssl-proxy
        role: ssl-proxy
    spec:
      containers:
      - name: nginx-ssl-proxy
        image: "docker.io/lsstsqre/nginx-ssl-proxy:latest"
        env:
          # Connect to the keeper service host and port
          # See keeper-service.yaml
          - name: SERVICE_HOST_ENV_NAME
            value: KEEPER_SERVICE_HOST
          - name: SERVICE_PORT_ENV_NAME
            value: KEEPER_SERVICE_PORT_HTTP
          - name: ENABLE_SSL
            value: 'true'
          - name: ENABLE_BASIC_AUTH
            value: 'false'
        ports:
          # nginx-ssl-proxy takes traffic on both http and https
          # See ssl-proxy-service
          - name: ssl-proxy-http
            containerPort: 80
          - name: ssl-proxy-https
            containerPort: 443
        volumeMounts:
        - name: secrets
          mountPath: /etc/secrets
          readOnly: true
      volumes:
      - name: secrets
        secret:
          secretName: ssl-proxy-secret
