hexlet-codebattle/codebattle

View on GitHub
k8s/app-chart/templates/runner_deployment.yaml

Summary

Maintainability
Test Coverage
{{- if eq "Deployment" .Values.runner.type -}}
kind: Deployment
apiVersion: apps/v1
metadata:
  name: "runner-deployment"
spec:
  replicas: {{ .Values.runner.replicaCount }}
  selector:
    matchLabels:
      app: "runner"
  strategy:
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  template:
    metadata:
      labels:
        app: "runner"
    spec:
      volumes:
        - name: users-code-path
          hostPath:
            path: /tmp/codebattle-runner
        - name: docker-sock
          hostPath:
            path: /var/run/docker.sock
      containers:
        - name: runner
          securityContext:
            privileged: true
          imagePullPolicy: "{{ .Values.runner.image.imagePullPolicy }}"
          image: "{{- if .Values.registry -}}{{ .Values.registry }}/{{- end -}}{{ .Values.runner.image.repository }}:{{ .Values.version }}"
          readinessProbe:
            httpGet:
              path: /health
              port: 4001
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
          command:
            - bin/runner
            - start
          ports:
            - containerPort: 4001
          volumeMounts:
            - mountPath: /tmp/codebattle-runner
              name: users-code-path
            - mountPath: /var/run/docker.sock
              name: docker-sock
          envFrom:
            - secretRef:
                name: codebattle-secrets
          env:
            - name: CODEBATTLE_VERSION
              value: {{ .Values.version }}
            - name: CODEBATTLE_RUNNER_PORT
              value: "4001"
            - name: RUNNER_PULL_DOCKER_IMAGES
              value: "true"
            - name: RUNNER_CONTAINER_KILLER
              value: "true"
            - name: DEPLOYED_AT
              value: {{ dateInZone "2006-01-02 15:04:05" (now) "UTC" }}
{{- end }}