hexlet-codebattle/codebattle

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

Summary

Maintainability
Test Coverage
{{- if .Values.runnerRust.enabled -}}
{{- range .Values.runnerRust.langs }}
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: "runner-{{ .name }}"
spec:
  replicas: {{ .replicaCount }}
  selector:
    matchLabels:
      app: "runner-{{ .name }}"
  strategy:
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  template:
    metadata:
      labels:
        app: "runner-{{ .name }}"
    spec:
      topologySpreadConstraints:
      - maxSkew: 3
        topologyKey: kubernetes.io/hostname
        whenUnsatisfiable: ScheduleAnyway
        labelSelector:
          matchLabels:
            app: "runner-{{ .name }}"
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: "codebattle"
            topologyKey: "kubernetes.io/hostname"
      containers:
        - name: "runner"
          env:
            - name: RUST_LOG
              value: debug
          resources:
            limits:
              cpu: "1"
              memory: "2Gi"
            requests:
              cpu: "150m"
              memory: "128Mi"
          imagePullPolicy: Always
          image: "{{- if $.Values.registry -}}{{ $.Values.registry }}/{{- end -}}{{ .image }}"
          readinessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
          command:
            - /runner/codebattle_runner
          ports:
            - containerPort: 8000
{{- end }}
{{- end }}