---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mindspore-website
spec:
  replicas: 6
  strategy:
    rollingUpdate:
      maxUnavailable: 2
    type: RollingUpdate
  selector:
    matchLabels:
      app: mindsporewebsite
  template:
    metadata:
      labels:
        app: mindsporewebsite
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: web
                operator: Exists
      containers:
      - name: website
        image: swr.cn-north-4.myhuaweicloud.com/opensourceway/mindspore/mindspore-website:66a4c8d25c244b2f2e18f2d95af1c65862bb8b63
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        env:
          - name: MS_MYSQL_URL
            value: jdbc:mysql://192.168.0.193:3306/website?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
          - name: MS_MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                key: mysql_password
                name: website-secrets
          - name: MS_MAIL_URL
            value: mail.mindspore.cn
          - name: MS_MAIL_NAME
            value: news@mindspore.cn
          - name: MS_MAIL_PASSWORD
            valueFrom:
              secretKeyRef:
                key: mail_password
                name: website-secrets
          - name: MS_REDIS_HOST
            value: 192.168.0.196
          - name: MS_REDIS_PASSWORD
            valueFrom:
              secretKeyRef:
                key: redis_password
                name: website-secrets
          - name: MS_PYTORCH_URL
            valueFrom:
              secretKeyRef:
                key: pytorch_url
                name: website-secrets
        resources:
          requests:
            cpu: 4000m
            memory: 4000Mi
          limits:
            cpu: 4000m
            memory: 8000Mi
        volumeMounts:
          - mountPath: /mnt/share/file
            name: website-data-volume
          - mountPath: /mnt/share/mindspore_repository
            name: website-hub-data-volume
      volumes:
        - name: website-data-volume
          persistentVolumeClaim:
            claimName: website-data
        - name: website-hub-data-volume
          persistentVolumeClaim:
            claimName: website-hub-data
