apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: oauth2-proxy
  name: oauth2-proxy
spec:
  replicas: 0
  selector:
    matchLabels:
      k8s-app: oauth2-proxy
  template:
    metadata:
      labels:
        k8s-app: oauth2-proxy
    spec:
      containers:
        - args:
            - --provider=gitee
            - --email-domain=*
            - --upstream=file:///dev/null
            - --http-address=0.0.0.0:4180
            - --cookie-expire=6h0m0s
            - --set-xauthrequest=true
          env:
            - name: OAUTH2_PROXY_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  key: client_id
                  name: website-secrets
            - name: OAUTH2_PROXY_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  key: client_secret
                  name: website-secrets
            - name: OAUTH2_PROXY_COOKIE_SECRET
              valueFrom:
                secretKeyRef:
                  key: cookie_secret
                  name: website-secrets
          image: swr.cn-north-4.myhuaweicloud.com/opensourceway/common/oauth2-proxy:226aef6138ef75975ecf9e2d6db5a21db26a1bcb
          imagePullPolicy: Always
          name: oauth2-proxy
          ports:
            - containerPort: 4180
              protocol: TCP
#---
#apiVersion: v1
#kind: Service
#metadata:
#  labels:
#    k8s-app: oauth2-proxy
#  name: oauth2-proxy
#spec:
#  ports:
#    - name: http
#      port: 4180
#      protocol: TCP
#      targetPort: 4180
#  selector:
#    k8s-app: oauth2-proxy
#---
#apiVersion: extensions/v1beta1
#kind: Ingress
#metadata:
#  name: oauth2-proxy
#spec:
#  rules:
#    - host: www.mindspore.cn
#      http:
#        paths:
#          - backend:
#              serviceName: oauth2-proxy
#              servicePort: 4180
#            path: /oauth2
#  tls:
#    - hosts:
#        - www.mindspore.cn
#      secretName: website-tls
