blob: 7b4e371a4019dca3880d710b016400fe3c162f59 [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 }}
Ajay Lotan Thakur0203c3b2022-03-21 13:40:11 -060026{{- if not .Values.config.gnbsim.singleInterface }}
badhri854c028b32021-11-03 18:24:05 -050027 annotations:
28 k8s.v1.cni.cncf.io/networks: '[
29 {
Hyunsun Moon2b21eb42022-03-24 01:52:22 -060030 "name": "gnb-net",
31 "interface": "gnb",
badhri854c028b32021-11-03 18:24:05 -050032{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
33 "ips": [{{ .Values.config.gnbsim.gnb.ip | quote }}]
34{{- else }}
35 "ips": {{ .Values.config.gnbsim.gnb.ip | quote }}
36{{- end }}
37 }
38 ]'
Ajay Lotan Thakur0203c3b2022-03-21 13:40:11 -060039{{- end }}
badhri854c028b32021-11-03 18:24:05 -050040 spec:
41 {{- if .Values.nodeSelectors.enabled }}
42 nodeSelector:
43 {{ .Values.nodeSelectors.gnbsim.label }}: {{ .Values.nodeSelectors.gnbsim.value }}
44 {{- end }}
45 serviceAccountName: gnbsim
46 {{- if hasKey .Values.images "pullSecrets" }}
47 imagePullSecrets:
48{{ toYaml .Values.images.pullSecrets | indent 8 }}
49 {{- end }}
Ajay Lotan Thakurd9252122022-08-30 22:35:59 +000050 initContainers:
Ajay Lotan Thakureadf7702022-09-30 00:02:58 -060051 - name: wait-amf-module
52 image: {{ .Values.images.repository }}{{ .Values.images.tags.init }}
53 imagePullPolicy: {{ .Values.images.pullPolicy }}
54 command: ['sh', '-c', 'until nslookup amf; do echo waiting for nrf; sleep 4; done;']
55 {{- if .Values.config.coreDump.enabled }}
Ajay Lotan Thakurd9252122022-08-30 22:35:59 +000056 {{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }}
badhri854c028b32021-11-03 18:24:05 -050057 {{- end }}
58 containers:
59 - name: gnbsim
Ajay Lotan Thakur71115fe2022-03-03 22:26:08 -070060 image: {{ .Values.images.repository }}{{ .Values.images.tags.gnbsim }}
badhri854c028b32021-11-03 18:24:05 -050061 imagePullPolicy: {{ .Values.images.pullPolicy }}
62 securityContext:
63 privileged: true
64 runAsUser: 0
65 stdin: true
66 tty: true
67 command: ["/opt/cp/scripts/gnbsim-run.sh"]
68 env:
69 - name: MEM_LIMIT
70 valueFrom:
71 resourceFieldRef:
72 containerName: gnbsim
73 resource: limits.memory
74 divisor: 1Mi
75 - name: POD_IP
76 valueFrom:
77 fieldRef:
78 fieldPath: status.podIP
79 {{- if .Values.resources.enabled }}
80 resources:
81{{ toYaml .Values.resources.gnbsim | indent 10 }}
82 {{- end }}
83 volumeMounts:
84 - name: cp-script
85 mountPath: /opt/cp/scripts/gnbsim-run.sh
86 subPath: gnbsim-run.sh
87 - name: cp-config
Ajay Lotan Thakur4ebd7e82022-01-14 09:11:42 -070088 mountPath: /gnbsim/config
badhri854c028b32021-11-03 18:24:05 -050089 {{- if .Values.config.coreDump.enabled }}
90 - name: coredump
91 mountPath: /tmp/coredump
92 {{- end }}
93 volumes:
94 - name: cp-script
95 configMap:
96 name: gnbsim
97 defaultMode: 493
98 - name: cp-config
99 configMap:
100 name: gnbsim
101 defaultMode: 420
102 {{- if .Values.config.coreDump.enabled }}
103 - name: host-rootfs
104 hostPath:
105 path: /
106 - name: coredump
107 hostPath:
108 path: {{ .Values.config.coreDump.path }}
109 {{- end }}
110{{- end }}