aboutsummaryrefslogtreecommitdiffstats
path: root/operations/a1-pe-sim-packages/resources/oran-sim-csar/o-ran-simulator/templates/_deployment.tpl
blob: e4b73539937d9c41e8a26d2c62659596fedc8f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{{/* vim: set filetype=mustache: */}}

{{/*
  Functions here are intended for Deployment resources use only
*/}}


{{/* Generate Deployment's container section */}}
{{/* Input: Dict with "dot", "name" and "spec" keys */}}
{{- define "handover-simulator.deployment.containers" -}}
{{- $name := .name -}}
{{- $spec := .spec -}}
{{- $dot := . -}}
{{- with .dot -}}
{{- range $owner, $containerSpec := $spec.containers }}
- name: {{ $owner }}
  image: "{{ $containerSpec.image.repository }}:{{ $containerSpec.image.tag }}"
  imagePullPolicy: {{ $containerSpec.image.pullPolicy }}
  {{- with $containerSpec.env }}
  env:
    {{- range $containerSpec.env }}
    {{/* This is ugly but helm's tpl required root object */}}
    - name: {{ .name }}
      value: {{ tpl .value $dot.dot | quote }}
    {{- end }}
  {{- end }}
  {{- with $containerSpec.command }}
  command:
    - {{ $containerSpec.command }}
  {{- end }}
  {{- with $containerSpec.args }}
  args:
    - {{ $containerSpec.args }}
  {{- end }}
  {{- with $containerSpec.volumeMounts }}
  volumeMounts:
    {{- range $containerSpec.volumeMounts }}
    - name: {{ .name }}
      mountPath: {{ .mountPath }}
    {{- end }}
  {{- end }}
  ports:
  {{- range $spec.service.ports }}
  {{- if eq $owner .owner }}
    - name: {{ .name }}
      containerPort: {{ .port }}
      protocol: TCP
  {{- end }}
  {{- end }}
  {{- with $containerSpec.volumes }}
  volumes: {{ toYaml . | nindent 4 }}
  {{- end }}
  {{- with $spec.livenessProbe }}
  livenessProbe:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- with $spec.readinessProbe }}
  readinessProbe:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- with $spec.resources }}
  resources:
    {{- toYaml . | nindent 4 }}
  {{- end }}
{{- end }}
{{- end -}}
{{- end -}}