blob: 7c2827df4b18a52d517948048fe0be62f8f469a6 [file] [log] [blame]
badhri854c028b32021-11-03 18:24:05 -05001{{/*
2# Copyright 2020-present Open Networking Foundation
3
Ajay Lotan Thakur03189d22022-02-10 14:06:03 -06004# SPDX-License-Identifier: Apache-2.0
badhri854c028b32021-11-03 18:24:05 -05005*/}}
6
7{{- if .Values.config.gnbsim.deploy }}
8{{ tuple "gnbsim" . | include "5g-ransim-plane.service_account" }}
9---
10apiVersion: apps/v1
11kind: StatefulSet
12metadata:
13 name: gnbsim
14 labels:
15{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }}
16spec:
17 replicas: 1
18 serviceName: gnbsim-headless
19 selector:
20 matchLabels:
21{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 6 }}
22 template:
23 metadata:
24 labels:
25{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 8 }}
26 annotations:
27 k8s.v1.cni.cncf.io/networks: '[
28 {
29 "name": "enb-net",
30 "interface": "enb",
31{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
32 "ips": [{{ .Values.config.gnbsim.gnb.ip | quote }}]
33{{- else }}
34 "ips": {{ .Values.config.gnbsim.gnb.ip | quote }}
35{{- end }}
36 }
37 ]'
38 spec:
39 {{- if .Values.nodeSelectors.enabled }}
40 nodeSelector:
41 {{ .Values.nodeSelectors.gnbsim.label }}: {{ .Values.nodeSelectors.gnbsim.value }}
42 {{- end }}
43 serviceAccountName: gnbsim
44 {{- if hasKey .Values.images "pullSecrets" }}
45 imagePullSecrets:
46{{ toYaml .Values.images.pullSecrets | indent 8 }}
47 {{- end }}
48
49 initContainers:
50 - name: wait-amf-module
Ajay Lotan Thakur71115fe2022-03-03 22:26:08 -070051 image: {{ .Values.images.repository }}{{ .Values.images.tags.init }}
badhri854c028b32021-11-03 18:24:05 -050052 imagePullPolicy: {{ .Values.images.pullPolicy }}
53 command: ['sh', '-c', 'until nslookup amf; do echo waiting for nrf; sleep 4; done;']
54 {{- if .Values.config.coreDump.enabled }}
55{{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }}
56 {{- end }}
57 containers:
58 - name: gnbsim
Ajay Lotan Thakur71115fe2022-03-03 22:26:08 -070059 image: {{ .Values.images.repository }}{{ .Values.images.tags.gnbsim }}
badhri854c028b32021-11-03 18:24:05 -050060 imagePullPolicy: {{ .Values.images.pullPolicy }}
61 securityContext:
62 privileged: true
63 runAsUser: 0
64 stdin: true
65 tty: true
66 command: ["/opt/cp/scripts/gnbsim-run.sh"]
67 env:
68 - name: MEM_LIMIT
69 valueFrom:
70 resourceFieldRef:
71 containerName: gnbsim
72 resource: limits.memory
73 divisor: 1Mi
74 - name: POD_IP
75 valueFrom:
76 fieldRef:
77 fieldPath: status.podIP
78 {{- if .Values.resources.enabled }}
79 resources:
80{{ toYaml .Values.resources.gnbsim | indent 10 }}
81 {{- end }}
82 volumeMounts:
83 - name: cp-script
84 mountPath: /opt/cp/scripts/gnbsim-run.sh
85 subPath: gnbsim-run.sh
86 - name: cp-config
Ajay Lotan Thakur4ebd7e82022-01-14 09:11:42 -070087 mountPath: /gnbsim/config
badhri854c028b32021-11-03 18:24:05 -050088 {{- if .Values.config.coreDump.enabled }}
89 - name: coredump
90 mountPath: /tmp/coredump
91 {{- end }}
92 volumes:
93 - name: cp-script
94 configMap:
95 name: gnbsim
96 defaultMode: 493
97 - name: cp-config
98 configMap:
99 name: gnbsim
100 defaultMode: 420
101 {{- if .Values.config.coreDump.enabled }}
102 - name: host-rootfs
103 hostPath:
104 path: /
105 - name: coredump
106 hostPath:
107 path: {{ .Values.config.coreDump.path }}
108 {{- end }}
109{{- end }}