apiVersion: apps/v1
kind: Deployment
metadata:
  name: websocket-service-deployment
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      component: server-websocket
  template:
    metadata:
      labels:
        component: server-websocket
        tier: microservices
        layer: services-external
    spec:
      serviceAccountName: therr-k8s-service-account
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - preference:
              matchExpressions:
              - key: cloud.google.com/gke-preemptible
                operator: DoesNotExist
            weight: 100
      containers:
      - name: server-websocket
        image: therrapp/websocket-service:latest
        resources:
          limits:
            memory: "256Mi"
            cpu: "100m"
        ports:
        - containerPort: 7743
        env:
        - name: MESSAGES_SERVICE_API_PORT
          value: "7772"
        - name: HONEYCOMB_API_KEY
          valueFrom:
            secretKeyRef:
              name: honeycomb-writekey
              key: HONEYCOMB
        - name: LOG_LEVEL
          value: "info"
        - name: LOGGING_DATASET
          value: "production"
        - name: REDIS_PUB_HOST
          value: "redis-cluster-ip-service"
        - name: REDIS_PUB_PORT
          value: "6379"
        - name: SOCKET_PORT
          value: "7743"
        - name: JWT_SECRET
          valueFrom:
            secretKeyRef:
              name: therrjwtsecret
              key: THERRJWT_SECRET