deployment.yaml 4.32 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
# if deploymentType is empty, or explicitly set to basic, use basic as default
{{- if or (not .Values.deploymentType) (eq .Values.deploymentType "basic") -}}
17
18
{{- range $serviceName, $serviceSpec := .Values.spec.services }}
---
19
20
21
apiVersion: apps/v1
kind: Deployment
metadata:
22
  name: {{ $.Release.Name }}-{{ $serviceName | lower }}
23
  labels:
24
    app: {{ $.Release.Name }}-{{ $serviceName | lower }}
25
spec:
26
  replicas: {{ $serviceSpec.replicas }}
27
28
  selector:
    matchLabels:
29
      app: {{ $.Release.Name }}-{{ $serviceName | lower }}
30
31
32
  template:
    metadata:
      labels:
33
        app: {{ $.Release.Name }}-{{ $serviceName | lower }}
34
    spec:
35
      {{- if $.Values.imagePullSecrets }}
36
      imagePullSecrets:
37
        {{ $.Values.imagePullSecrets | toYaml | nindent 8 }}
38
      {{- end }}
39
      containers:
40
41
42
      - name: {{ $.Release.Name }}-{{ $serviceName | lower }}
        image: {{ $serviceSpec.extraPodSpec.mainContainer.image }}
        workingDir: {{ $serviceSpec.extraPodSpec.mainContainer.workingDir }}
43
44
45
46
47
        {{- if $serviceSpec.extraPodSpec.mainContainer.command }}
        command:
        {{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 8 }}
        {{- end }}
        {{- if $serviceSpec.extraPodSpec.mainContainer.args }}
48
        args:
49
        {{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }}
50
        {{- end }}
51
        {{ if $serviceSpec.resources }}
52
53
        resources:
          requests:
54
55
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
56
            {{ end }}
57
58
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
59
            {{ end }}
60
61
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
62
            {{ end }}
63
          limits:
64
65
            {{ if $serviceSpec.resources.cpu }}
            cpu: "{{ $serviceSpec.resources.cpu }}"
66
            {{ end }}
67
68
            {{ if $serviceSpec.resources.memory }}
            memory: "{{ $serviceSpec.resources.memory }}"
69
            {{ end }}
70
71
            {{ if $serviceSpec.resources.gpu }}
            nvidia.com/gpu: "{{ $serviceSpec.resources.gpu }}"
72
            {{ end }}
73
        {{ end }}
74
75
76
77
        {{- if $serviceSpec.envFromSecret }}
        envFrom:
        - secretRef:
            name: {{ $serviceSpec.envFromSecret }}
78
        {{- end }}
79
        env:
80
        - name: DYNAMO_PORT
81
          value: "{{ $.Values.dynamoPort | default 8000 }}"
82
        {{- if $.Values.etcdAddr }}
83
        - name: ETCD_ENDPOINTS
84
85
86
87
88
          value: "{{ $.Values.etcdAddr }}"
        {{- end }}
        {{- if $.Values.natsAddr }}
        - name: NATS_SERVER
          value: "{{ $.Values.natsAddr }}"
89
        {{- end }}
90
91
92
93
        ports:
        - name: health
          containerPort: {{ $.Values.healthPort | default 5000 }}
        livenessProbe:
94
95
          {{- if $serviceSpec.livenessProbe }}
          {{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
96
97
98
99
100
101
102
103
104
105
106
107
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /healthz
            port: health
            scheme: HTTP
          {{- end }}
        readinessProbe:
108
109
          {{- if $serviceSpec.readinessProbe }}
          {{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
110
111
112
113
114
115
116
117
118
119
120
          {{- else }}
          initialDelaySeconds: 60
          periodSeconds: 60
          timeoutSeconds: 5
          failureThreshold: 10
          successThreshold: 1
          httpGet:
            path: /readyz
            port: health
            scheme: HTTP
          {{- end }}
121
{{- end }}
122
{{- end }}