apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: oauth2-proxy
  name: oauth2-proxy
  namespace: oauth2-proxy
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: oauth2-proxy
  template:
    metadata:
      labels:
        k8s-app: oauth2-proxy
    spec:
      containers:
      - args:
        - --provider=github
        - --email-domain=*
        - --http-address=0.0.0.0:4180
        - --pass-access-token
        - --cookie-expire=20h
        env:
        ##############################################
        # OAUTH2-PROVIDER-CONFIG
        - name: OAUTH2_PROXY_COOKIE_SECRET
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: cookie_secret
        - name: OAUTH2_PROXY_CLIENT_ID
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: client_id
        - name: OAUTH2_PROXY_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: client_secret
        - name: OAUTH2_PROXY_GITHUB_ORG
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: github_org
        - name: OAUTH2_PROXY_GITHUB_TEAM
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: github_team
        - name: OAUTH2_PROXY_COOKIE_DOMAINS
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: cookie_domain
        - name: OAUTH2_PROXY_WHITELIST_DOMAINS
          valueFrom:
            secretKeyRef:
              name: oauth2-github-secret
              key: cookie_domain
        ##############################################
        image: quay.io/oauth2-proxy/oauth2-proxy:latest
        imagePullPolicy: Always
        name: oauth2-proxy
        ports:
        - containerPort: 4180
          protocol: TCP
