apiVersion: v1
kind: Service
metadata:
  labels:
    app: universe
  name: universe-svc
  namespace: ffs-system
spec:
  ports:
    - name: universe-cluster
      port: 9091
      protocol: TCP
      targetPort: 9091
  selector:
    ffs.tidbcloud: universe
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    ffs.tidbcloud: universe
  name: universe
  namespace: ffs-system
spec:
  replicas: 3
  selector:
    matchLabels:
      ffs.tidbcloud: universe
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: universe
        ffs.tidbcloud: universe
    spec:
      nodeSelector:
        universe-etcd.tidbcloud.com/node: "true"
      tolerations:
        - effect: NoSchedule
          key: universe-etcd.tidbcloud.com/node
          operator: Equal
          value: "true"
      topologySpreadConstraints:
        - labelSelector:
            matchLabels:
              ffs.tidbcloud: universe
          maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: DoNotSchedule
      containers:
        - command:
            - /bin/sh
            - -ec
            - universe-server-linux --log-level=warn --endpoints=${ENDPOINTS} --addr=0.0.0.0:9091
          env:
            - name: ENDPOINTS
              value: etcd-svc.tidb-admin:2379
          image: universe
          imagePullPolicy: IfNotPresent
          name: universe
          ports:
            - containerPort: 9091
              name: universe
              protocol: TCP
