blob: d62293b2859544d075f782a39af4287b05a3d372 [file] [log] [blame]
Badhrinath987e1d82020-11-20 13:23:58 -06001{{/*
2# Copyright 2020-present Open Networking Foundation
3
4# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
5*/}}
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
Vini Gajjare34804b2021-10-19 17:49:43 +053044 {{- if hasKey .Values.images "pullSecrets" }}
Badhrinath987e1d82020-11-20 13:23:58 -060045 imagePullSecrets:
Vini Gajjare34804b2021-10-19 17:49:43 +053046{{ toYaml .Values.images.pullSecrets | indent 8 }}
Badhrinath987e1d82020-11-20 13:23:58 -060047 {{- end }}
Vini Gajjare34804b2021-10-19 17:49:43 +053048
Badhrinath987e1d82020-11-20 13:23:58 -060049 initContainers:
50 - name: wait-amf-module
51 image: {{ .Values.images.tags.init | quote }}
52 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
59 image: {{ .Values.images.tags.gnbsim }}
60 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
87 mountPath: /free5gc/config
88 {{- 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 }}