deployment.yaml 4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
15
16
{{- range $serviceName, $serviceSpec := .Values.spec.services }}
---
17
18
19
apiVersion: apps/v1
kind: Deployment
metadata:
20
  name: {{ $.Release.Name }}-{{ $serviceName | lower }}
21
  labels:
22
    app: {{ $.Release.Name }}-{{ $serviceName | lower }}
23
spec:
24
  replicas: {{ $serviceSpec.replicas }}
25
26
  selector:
    matchLabels:
27
      app: {{ $.Release.Name }}-{{ $serviceName | lower }}
28
29
30
  template:
    metadata:
      labels:
31
        app: {{ $.Release.Name }}-{{ $serviceName | lower }}
32
    spec:
33
      {{- if $.Values.imagePullSecrets }}
34
      imagePullSecrets:
35
        {{ $.Values.imagePullSecrets | toYaml | nindent 8 }}
36
      {{- end }}
37
      containers:
38
39
40
      - name: {{ $.Release.Name }}-{{ $serviceName | lower }}
        image: {{ $serviceSpec.extraPodSpec.mainContainer.image }}
        workingDir: {{ $serviceSpec.extraPodSpec.mainContainer.workingDir }}
41
        args:
42
43
        {{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }}
        {{ if $serviceSpec.resources }}
44
45
        resources:
          requests:
46
47
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
48
            {{ end }}
49
50
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
51
            {{ end }}
52
53
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
54
            {{ end }}
55
          limits:
56
57
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
58
            {{ end }}
59
60
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
61
            {{ end }}
62
63
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
64
            {{ end }}
65
        {{ end }}
66
67
68
69
        {{- if $serviceSpec.envFromSecret }}
        envFrom:
        - secretRef:
            name: {{ $serviceSpec.envFromSecret }}
70
        {{- end }}
71
        env:
72
        - name: DYNAMO_PORT
73
          value: "{{ $.Values.dynamoPort | default 8000 }}"
74
        {{- if $.Values.etcdAddr }}
75
        - name: ETCD_ENDPOINTS
76
77
78
79
80
          value: "{{ $.Values.etcdAddr }}"
        {{- end }}
        {{- if $.Values.natsAddr }}
        - name: NATS_SERVER
          value: "{{ $.Values.natsAddr }}"
81
        {{- end }}
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
        ports:
        - name: health
          containerPort: {{ $.Values.healthPort | default 5000 }}
        livenessProbe:
          {{- if $serviceSpec.extraPodSpec.mainContainer.livenessProbe }}
          {{ $serviceSpec.extraPodSpec.mainContainer.livenessProbe | toYaml | nindent 10 }}
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /healthz
            port: health
            scheme: HTTP
          {{- end }}
        readinessProbe:
          {{- if $serviceSpec.extraPodSpec.mainContainer.readinessProbe }}
          {{ $serviceSpec.extraPodSpec.mainContainer.readinessProbe | toYaml | nindent 10 }}
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /readyz
            port: health
            scheme: HTTP
          {{- end }}
113
{{- end }}