apiVersion: apps/v1
kind: Deployment
metadata:
  name: apisix-dashboard
  namespace: apisix
  labels:
    app: apisix-dashboard
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apisix-dashboard
  template:
    metadata:
      labels:
        app: apisix-dashboard
    spec:
      containers:
        - name: apisix-dashboard
          image: apache/apisix-dashboard:3.0.1-alpine
          ports:
            - name: http
              containerPort: 9000
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /ping
              port: http
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /ping
              port: http
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          volumeMounts:
            - name: apisix-dashboard-config
              mountPath: /usr/local/apisix-dashboard/conf/conf.yaml
              subPath: conf.yaml
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: apisix-dashboard
      serviceAccount: apisix-dashboard
      volumes:
        - name: apisix-dashboard-config
          configMap:
            name: dashboard-conf
            defaultMode: 420
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: dashboard-conf
  namespace: apisix
  labels:
    app: apisix-dashboard
data:
  conf.yaml: |-
    conf:
      listen:
        host: 0.0.0.0
        port: 9000
      etcd:
        endpoints:
          - etcd-svc.apisix.svc.cluster.local:2379
      log:
        error_log:
          level: warn
          file_path: logs/error.log
        access_log:
          file_path: logs/access.log
    
    authentication:
      secert:
        secert
      expire_time: 3600
      users:
        - username: admin
          password: Q39sTi0i^9Q39sTi
    oidc:
      enabled: true
      expire_time: 3600
      client_id: 66988785c093dfebef29a7a1
      client_secret: 77bb2a9ebf6a1eea55d4d96466de088a
      auth_url: https://pingcap-apisix.authing.cn/oidc/auth
      token_url: https://pingcap-apisix.authing.cn/oidc/token
      user_info_url: https://pingcap-apisix.authing.cn/oidc/me
      redirect_url: https://apisix.pingcap.net/apisix/admin/oidc/callback
      scope: openid
    
    plugins:
      - api-breaker
      - authz-casbin
      - authz-casdoor
      - authz-keycloak
      - aws-lambda
      - azure-functions
      - basic-auth
      # - batch-requests
      - clickhouse-logger
      - client-control
      - consumer-restriction
      - cors
      - csrf
      - datadog
      # - dubbo-proxy
      - echo
      - error-log-logger
      # - example-plugin
      - ext-plugin-post-req
      - ext-plugin-post-resp
      - ext-plugin-pre-req
      - fault-injection
      - file-logger
      - forward-auth
      - google-cloud-logging
      - grpc-transcode
      - grpc-web
      - gzip
      - hmac-auth
      - http-logger
      - ip-restriction
      - jwt-auth
      - kafka-logger
      - kafka-proxy
      - key-auth
      - ldap-auth
      - limit-conn
      - limit-count
      - limit-req
      - loggly
      # - log-rotate
      - mocking
      # - node-status
      - opa
      - openid-connect
      - opentelemetry
      - openwhisk
      - prometheus
      - proxy-cache
      - proxy-control
      - proxy-mirror
      - proxy-rewrite
      - public-api
      - real-ip
      - redirect
      - referer-restriction
      - request-id
      - request-validation
      - response-rewrite
      - rocketmq-logger
      - server-info
      - serverless-post-function
      - serverless-pre-function
      - skywalking
      - skywalking-logger
      - sls-logger
      - splunk-hec-logging
      - syslog
      - tcp-logger
      - traffic-split
      - ua-restriction
      - udp-logger
      - uri-blocker
      - wolf-rbac
      - zipkin
      - elasticsearch-logge
      - openfunction
      - tencent-cloud-cls
      - ai
      - cas-auth
---
apiVersion: v1
kind: Service
metadata:
  name: apisix-dashboard
  namespace: apisix
  labels:
    app: apisix-dashboard
spec:
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: http
  selector:
    app: apisix-dashboard
  type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: apisix-dashboard
  namespace: apisix  
