apiVersion: v1
kind: Namespace
metadata:
  name: seafile
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: memcached
  namespace: seafile
spec:
  replicas: 1
  selector:
    matchLabels:
      app: memcached
  template:
    metadata:
      labels:
        app: memcached
    spec:
      containers:
        - name: memcached
          image: hub.yizhisec.com/product/hybridscope/memcached
          args: ["-m", "256"]
          ports:
            - containerPort: 11211
---
apiVersion: v1
kind: Service
metadata:
  name: memcached
  namespace: seafile
spec:
  selector:
    app: memcached
  ports:
    - protocol: TCP
      port: 11211
      targetPort: 11211

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: seafile
  namespace: seafile
spec:
  replicas: 1
  selector:
    matchLabels:
      app: seafile
  template:
    metadata:
      labels:
        app: seafile
    spec:
      containers:
        - name: seafile
          image: hub.yizhisec.com/product/hybridscope/seafile-mc:latest
          imagePullPolicy: IfNotPresent
          env:
            - name: DB_HOST
              value: "mysql-cluster-mysql-master.db-mysql"
            - name: DB_ROOT_PASSWD
              value: "L0hMysql." #db's password
            - name: TIME_ZONE
              value: "Asia/Shanghai"
            - name: SEAFILE_ADMIN_EMAIL
              value: "admin@yizhisec.com" #admin email
            - name: SEAFILE_ADMIN_PASSWORD
              value: "asecret" #admin password
            - name: SEAFILE_SERVER_LETSENCRYPT
              value: "false"
            - name: SEAFILE_SERVER_HOSTNAME
              value: "cloud.hybridscope.com" #hostname
          ports:
            - containerPort: 80
          volumeMounts:
            - name: seafile-data
              mountPath: /shared
      volumes:
        - name: seafile-data
          persistentVolumeClaim:
            claimName: seafile-data
      restartPolicy: Always
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: seafile-data
  namespace: seafile
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 10Gi
