deployment.yaml 4.16 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
42
43
44
45
        {{- if $serviceSpec.extraPodSpec.mainContainer.command }}
        command:
        {{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 8 }}
        {{- end }}
        {{- if $serviceSpec.extraPodSpec.mainContainer.args }}
46
        args:
47
        {{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }}
48
        {{- end }}
49
        {{ if $serviceSpec.resources }}
50
51
        resources:
          requests:
52
53
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
54
            {{ end }}
55
56
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
57
            {{ end }}
58
59
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
60
            {{ end }}
61
          limits:
62
63
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
64
            {{ end }}
65
66
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
67
            {{ end }}
68
69
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
70
            {{ end }}
71
        {{ end }}
72
73
74
75
        {{- if $serviceSpec.envFromSecret }}
        envFrom:
        - secretRef:
            name: {{ $serviceSpec.envFromSecret }}
76
        {{- end }}
77
        env:
78
        - name: DYNAMO_PORT
79
          value: "{{ $.Values.dynamoPort | default 8000 }}"
80
        {{- if $.Values.etcdAddr }}
81
        - name: ETCD_ENDPOINTS
82
83
84
85
86
          value: "{{ $.Values.etcdAddr }}"
        {{- end }}
        {{- if $.Values.natsAddr }}
        - name: NATS_SERVER
          value: "{{ $.Values.natsAddr }}"
87
        {{- end }}
88
89
90
91
        ports:
        - name: health
          containerPort: {{ $.Values.healthPort | default 5000 }}
        livenessProbe:
92
93
          {{- if $serviceSpec.livenessProbe }}
          {{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
94
95
96
97
98
99
100
101
102
103
104
105
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /healthz
            port: health
            scheme: HTTP
          {{- end }}
        readinessProbe:
106
107
          {{- if $serviceSpec.readinessProbe }}
          {{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
108
109
110
111
112
113
114
115
116
117
118
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /readyz
            port: health
            scheme: HTTP
          {{- end }}
119
{{- end }}