apiVersion: apps/v1
kind: Deployment
metadata:
  name: easyai-acceptance-emulator
  namespace: easyai
  labels:
    app.kubernetes.io/name: easyai-acceptance-emulator
    easyai.io/environment: local-acceptance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: easyai-acceptance-emulator
  template:
    metadata:
      labels:
        app.kubernetes.io/name: easyai-acceptance-emulator
        easyai.io/environment: local-acceptance
    spec:
      nodeSelector:
        easyai.io/site: ningbo
      containers:
        - name: emulator
          image: easyai-api
          command: ["/app/easyai-ai-gateway-acceptance-emulator"]
          env:
            - name: HTTP_ADDR
              value: ":8090"
          ports:
            - name: http
              containerPort: 8090
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: "2"
              memory: 1Gi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop: ["ALL"]
            readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
  name: easyai-acceptance-emulator
  namespace: easyai
spec:
  selector:
    app.kubernetes.io/name: easyai-acceptance-emulator
  ports:
    - name: http
      port: 8090
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: easyai-acceptance-callback-collector
  namespace: easyai
  labels:
    app.kubernetes.io/name: easyai-acceptance-callback-collector
    easyai.io/environment: local-acceptance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: easyai-acceptance-callback-collector
  template:
    metadata:
      labels:
        app.kubernetes.io/name: easyai-acceptance-callback-collector
        easyai.io/environment: local-acceptance
    spec:
      nodeSelector:
        easyai.io/site: ningbo
      containers:
        - name: collector
          image: easyai-api
          command: ["/app/easyai-ai-gateway-acceptance-callback-collector"]
          env:
            - name: HTTP_ADDR
              value: ":8091"
          ports:
            - name: http
              containerPort: 8091
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
          resources:
            requests:
              cpu: 20m
              memory: 32Mi
            limits:
              cpu: 250m
              memory: 128Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop: ["ALL"]
            readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
  name: easyai-acceptance-callback-collector
  namespace: easyai
spec:
  selector:
    app.kubernetes.io/name: easyai-acceptance-callback-collector
  ports:
    - name: http
      port: 8091
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: easyai-acceptance-upstream-proxy
  namespace: easyai
  labels:
    app.kubernetes.io/name: easyai-acceptance-upstream-proxy
    easyai.io/environment: local-acceptance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: easyai-acceptance-upstream-proxy
  template:
    metadata:
      labels:
        app.kubernetes.io/name: easyai-acceptance-upstream-proxy
        easyai.io/environment: local-acceptance
    spec:
      nodeSelector:
        easyai.io/site: hongkong
      containers:
        - name: proxy
          image: easyai-acceptance-netem
          env:
            - name: NETEM_LISTEN_PORT
              value: "18090"
            - name: NETEM_TARGET_HOST
              value: easyai-acceptance-emulator.easyai.svc.cluster.local
            - name: NETEM_TARGET_PORT
              value: "8090"
          ports:
            - name: proxy
              containerPort: 18090
          resources:
            requests:
              cpu: 20m
              memory: 32Mi
            limits:
              cpu: 250m
              memory: 128Mi
          securityContext:
            runAsUser: 0
            allowPrivilegeEscalation: false
            capabilities:
              add: ["NET_ADMIN"]
              drop: ["ALL"]
            readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
  name: easyai-acceptance-upstream-proxy
  namespace: easyai
spec:
  selector:
    app.kubernetes.io/name: easyai-acceptance-upstream-proxy
  ports:
    - name: proxy
      port: 8090
      targetPort: proxy
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: easyai-postgres-proxy-ningbo
  namespace: easyai
  labels:
    app.kubernetes.io/name: easyai-postgres-proxy
    easyai.io/site: ningbo
    easyai.io/environment: local-acceptance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: easyai-postgres-proxy
      easyai.io/site: ningbo
  template:
    metadata:
      labels:
        app.kubernetes.io/name: easyai-postgres-proxy
        easyai.io/site: ningbo
        easyai.io/environment: local-acceptance
    spec:
      nodeSelector:
        easyai.io/site: ningbo
      containers:
        - name: proxy
          image: easyai-acceptance-netem
          env:
            - name: NETEM_LISTEN_PORT
              value: "15432"
            - name: NETEM_TARGET_HOST
              value: easyai-postgres-rw.easyai.svc.cluster.local
            - name: NETEM_TARGET_PORT
              value: "5432"
          ports:
            - name: postgres
              containerPort: 15432
          resources:
            requests:
              cpu: 20m
              memory: 32Mi
            limits:
              cpu: 250m
              memory: 128Mi
          securityContext:
            runAsUser: 0
            allowPrivilegeEscalation: false
            capabilities:
              add: ["NET_ADMIN"]
              drop: ["ALL"]
            readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
  name: easyai-postgres-proxy-ningbo
  namespace: easyai
spec:
  selector:
    app.kubernetes.io/name: easyai-postgres-proxy
    easyai.io/site: ningbo
  ports:
    - name: postgres
      port: 5432
      targetPort: postgres
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: easyai-postgres-proxy-hongkong
  namespace: easyai
  labels:
    app.kubernetes.io/name: easyai-postgres-proxy
    easyai.io/site: hongkong
    easyai.io/environment: local-acceptance
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: easyai-postgres-proxy
      easyai.io/site: hongkong
  template:
    metadata:
      labels:
        app.kubernetes.io/name: easyai-postgres-proxy
        easyai.io/site: hongkong
        easyai.io/environment: local-acceptance
    spec:
      nodeSelector:
        easyai.io/site: hongkong
      containers:
        - name: proxy
          image: easyai-acceptance-netem
          env:
            - name: NETEM_LISTEN_PORT
              value: "15432"
            - name: NETEM_TARGET_HOST
              value: easyai-postgres-rw.easyai.svc.cluster.local
            - name: NETEM_TARGET_PORT
              value: "5432"
          ports:
            - name: postgres
              containerPort: 15432
          resources:
            requests:
              cpu: 20m
              memory: 32Mi
            limits:
              cpu: 250m
              memory: 128Mi
          securityContext:
            runAsUser: 0
            allowPrivilegeEscalation: false
            capabilities:
              add: ["NET_ADMIN"]
              drop: ["ALL"]
            readOnlyRootFilesystem: true
---
apiVersion: v1
kind: Service
metadata:
  name: easyai-postgres-proxy-hongkong
  namespace: easyai
spec:
  selector:
    app.kubernetes.io/name: easyai-postgres-proxy
    easyai.io/site: hongkong
  ports:
    - name: postgres
      port: 5432
      targetPort: postgres
