agones.dev/agones@v1.53.0/install/helm/agones/templates/processor.yaml (about)

     1  # Copyright 2025 Google LLC All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  {{- $featureGates := include "agones.featureGates" . | fromYaml }}
    16  {{- if $featureGates.ProcessorAllocator }}
    17  apiVersion: apps/v1
    18  kind: Deployment
    19  metadata:
    20    name: agones-processor
    21    namespace: {{ .Release.Namespace }}
    22    labels:
    23      component: processor
    24      app: {{ template "agones.name" . }}
    25      chart: {{ template "agones.chart" . }}
    26      release: {{ .Release.Name }}
    27      heritage: {{ .Release.Service }}
    28  spec:
    29    replicas: {{ .Values.agones.allocator.processor.replicas }}
    30    selector:
    31      matchLabels:
    32        agones.dev/role: processor
    33        app: {{ template "agones.name" . }}
    34        release: {{ .Release.Name }}
    35        heritage: {{ .Release.Service }}
    36    strategy:
    37      type: Recreate
    38    template:
    39      metadata:
    40        annotations:
    41  {{- if and (.Values.agones.metrics.prometheusServiceDiscovery) (.Values.agones.metrics.prometheusEnabled) }}
    42          prometheus.io/scrape: "true"
    43          prometheus.io/port: {{ .Values.agones.allocator.processor.http.port | quote }}
    44          prometheus.io/path: "/metrics"
    45  {{- end }}
    46  {{- if .Values.agones.allocator.processor.annotations }}
    47  {{- toYaml .Values.agones.allocator.processor.annotations | nindent 8 }}
    48  {{- end }}
    49        labels:
    50          agones.dev/role: processor
    51          app: {{ template "agones.name" . }}
    52          release: {{ .Release.Name }}
    53          heritage: {{ .Release.Service }}
    54  {{- if .Values.agones.allocator.processor.labels }}
    55  {{- toYaml .Values.agones.allocator.processor.labels | nindent 8 }}
    56  {{- end }}
    57      spec:
    58        {{- if .Values.agones.allocator.processor.topologySpreadConstraints }}
    59        topologySpreadConstraints:
    60          {{- toYaml .Values.agones.allocator.processor.topologySpreadConstraints | nindent 8 }}
    61        {{- end }}
    62        affinity:
    63        {{- if .Values.agones.allocator.processor.affinity }}
    64        {{- if .Values.agones.requireDedicatedNodes }}
    65        {{- fail "agones.allocator.processor.affinity and agones.requireDedicatedNodes cannot be set at the same time!" }}
    66        {{- end}}
    67        {{- end}}
    68        {{- if .Values.agones.allocator.processor.affinity }}
    69  {{ toYaml .Values.agones.allocator.processor.affinity | indent 8 }}
    70        {{- else}}
    71          nodeAffinity:
    72            {{- if .Values.agones.requireDedicatedNodes }}
    73            requiredDuringSchedulingIgnoredDuringExecution:
    74              nodeSelectorTerms:
    75              - matchExpressions:
    76            {{- else}}
    77            preferredDuringSchedulingIgnoredDuringExecution:
    78            - weight: 1
    79              preference:
    80                matchExpressions:
    81            {{- end }}
    82                - key: agones.dev/agones-system
    83                  operator: Exists
    84        {{- end }}
    85        {{- if .Values.agones.allocator.processor.nodeSelector }}
    86        nodeSelector:
    87  {{ toYaml .Values.agones.allocator.processor.nodeSelector | indent 8 }}
    88        {{- end }}
    89        {{- if .Values.agones.allocator.processor.tolerations }}
    90        tolerations:
    91  {{ toYaml .Values.agones.allocator.processor.tolerations | indent 8 }}
    92        {{- end }}
    93        {{- if .Values.agones.createPriorityClass }}
    94        priorityClassName: {{ .Values.agones.priorityClassName }}
    95        {{- end }}
    96        serviceAccountName: {{ .Values.agones.serviceaccount.controller.name }}
    97        terminationGracePeriodSeconds: {{ mul .Values.agones.allocator.processor.readiness.periodSeconds .Values.agones.allocator.processor.readiness.failureThreshold 3 }}
    98        containers:
    99        - name: agones-processor
   100          image: "{{ .Values.agones.image.registry }}/{{ .Values.agones.image.processor.name}}:{{ default .Values.agones.image.tag .Values.agones.image.processor.tag }}"
   101          imagePullPolicy: {{ .Values.agones.image.processor.pullPolicy }}
   102          securityContext:
   103            runAsNonRoot: true
   104            runAsUser: 1000
   105            allowPrivilegeEscalation: false
   106          env:
   107          - name: LOG_LEVEL
   108            value: {{ .Values.agones.allocator.processor.logLevel | quote }}
   109          - name: POD_NAMESPACE
   110            valueFrom:
   111              fieldRef:
   112                fieldPath: metadata.namespace
   113          {{- if gt (int .Values.agones.allocator.processor.replicas) 1 }}
   114          - name: LEADER_ELECTION
   115            value: "true"
   116          - name: LEASE_DURATION
   117            value: {{ .Values.agones.allocator.processor.leaderElection.leaseDuration | default "15s" | quote }}
   118          - name: RENEW_DEADLINE
   119            value: {{ .Values.agones.allocator.processor.leaderElection.renewDeadline | default "10s" | quote }}
   120          - name: RETRY_PERIOD
   121            value: {{ .Values.agones.allocator.processor.leaderElection.retryPeriod | default "2s" | quote }}
   122          {{- end }}
   123          livenessProbe:
   124            httpGet:
   125              path: /live
   126              port: http
   127            initialDelaySeconds: {{ .Values.agones.allocator.processor.healthCheck.initialDelaySeconds }}
   128            periodSeconds: {{ .Values.agones.allocator.processor.healthCheck.periodSeconds }}
   129            failureThreshold: {{ .Values.agones.allocator.processor.healthCheck.failureThreshold }}
   130            timeoutSeconds: {{ .Values.agones.allocator.processor.healthCheck.timeoutSeconds }}
   131          readinessProbe:
   132            httpGet:
   133              path: /ready
   134              port: http
   135            initialDelaySeconds: {{ .Values.agones.allocator.processor.readiness.initialDelaySeconds }}
   136            periodSeconds: {{ .Values.agones.allocator.processor.readiness.periodSeconds }}
   137            failureThreshold: {{ .Values.agones.allocator.processor.readiness.failureThreshold }}
   138          ports:
   139          - name: http
   140            containerPort: {{ .Values.agones.allocator.processor.http.port }}
   141          resources:
   142  {{- if .Values.agones.allocator.processor.resources }}
   143  {{ toYaml .Values.agones.allocator.processor.resources | indent 10 }}
   144  {{- else}}
   145            requests:
   146              cpu: 10m
   147              memory: 32Mi
   148            limits:
   149              cpu: 500m
   150              memory: 256Mi
   151  {{- end }}
   152  {{- if .Values.agones.image.processor.pullSecret }}
   153        imagePullSecrets:
   154          - name: {{.Values.agones.image.processor.pullSecret}}
   155  {{- end }}
   156  ---
   157  apiVersion: v1
   158  kind: Service
   159  metadata:
   160    name: agones-processor
   161    namespace: {{ .Release.Namespace }}
   162    labels:
   163      agones.dev/role: processor
   164      app: {{ template "agones.name" . }}
   165      release: {{ .Release.Name }}
   166      heritage: {{ .Release.Service }}
   167  spec:
   168    clusterIP: None
   169    selector:
   170      agones.dev/role: processor
   171      app: {{ template "agones.name" . }}
   172      release: {{ .Release.Name }}
   173      heritage: {{ .Release.Service }}
   174    ports:
   175      - port: {{ .Values.agones.allocator.processor.http.port }}
   176        name: http
   177        targetPort: {{ .Values.agones.allocator.processor.http.port }}
   178  {{- end }}