apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    description: LSP server for Go (used for background indexing jobs).
  labels:
    deploy: xlang-go
  name: xlang-go-bg
spec:
  minReadySeconds: 10
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: xlang-go-bg
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: xlang-go-bg
    spec:
      containers:
      - args:
        - -mode=tcp
        - -addr=:4389
        env:
        - name: CONFIG_FILE_HASH
          value: ad622f4e70f7edc1056a270559e8ca07bba00abd81c1bea1e8940c7156532081
        - name: SOURCEGRAPH_CONFIG_FILE
          value: /etc/sourcegraph/config.json
          # SRC_GIT_SERVERS must be kept in sync with the specified replica count in
          # gitserver.Statefulset.yaml
          # See ../../docs/configure.md for more information.
        - name: SRC_GIT_SERVERS
          value: gitserver-0.gitserver:3178
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: CACHE_DIR
          value: /mnt/cache/$(POD_NAME)
        image: sourcegraph/xlang-go:2.11.2@sha256:4ba89336ce8f929b291e13eaf5f0330de38c008c524998cbefb353fac166995d
        livenessProbe:
          initialDelaySeconds: 5
          tcpSocket:
            port: lsp
          timeoutSeconds: 5
        name: xlang-go-bg
        ports:
        - containerPort: 4389
          name: lsp
        - containerPort: 6060
          name: debug
        readinessProbe:
          tcpSocket:
            port: 4389
        resources:
          limits:
            cpu: "4"
            memory: 8Gi
          requests:
            cpu: 500m
            memory: 2Gi
        volumeMounts:
        - mountPath: /etc/sourcegraph
          name: sg-config
        - mountPath: /mnt/cache
          name: cache-ssd
      securityContext:
        runAsUser: 0
      volumes:
      - configMap:
          defaultMode: 464
          name: config-file
        name: sg-config
      # See ../../docs/configure.md for more information about how to increase the
      # performance of this delpoyment by using an SSD.
      - emptyDir: {}
        name: cache-ssd
