blob: fe887208e16c53ac9b262838755a4f6e73d884da [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
44 {{- if .Values.images.credentials }}
45 imagePullSecrets:
46 - name: {{ .Release.Name }}.registry
47 {{- end }}
48 initContainers:
49 - name: wait-amf-module
50 image: {{ .Values.images.tags.init | quote }}
51 imagePullPolicy: {{ .Values.images.pullPolicy }}
52 command: ['sh', '-c', 'until nslookup amf; do echo waiting for nrf; sleep 4; done;']
53 {{- if .Values.config.coreDump.enabled }}
54{{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }}
55 {{- end }}
56 containers:
57 - name: gnbsim
58 image: {{ .Values.images.tags.gnbsim }}
59 imagePullPolicy: {{ .Values.images.pullPolicy }}
60 securityContext:
61 privileged: true
62 runAsUser: 0
63 stdin: true
64 tty: true
65 command: ["/opt/cp/scripts/gnbsim-run.sh"]
66 env:
67 - name: MEM_LIMIT
68 valueFrom:
69 resourceFieldRef:
70 containerName: gnbsim
71 resource: limits.memory
72 divisor: 1Mi
73 - name: POD_IP
74 valueFrom:
75 fieldRef:
76 fieldPath: status.podIP
77 {{- if .Values.resources.enabled }}
78 resources:
79{{ toYaml .Values.resources.gnbsim | indent 10 }}
80 {{- end }}
81 volumeMounts:
82 - name: cp-script
83 mountPath: /opt/cp/scripts/gnbsim-run.sh
84 subPath: gnbsim-run.sh
85 - name: cp-config
86 mountPath: /free5gc/config
87 {{- if .Values.config.coreDump.enabled }}
88 - name: coredump
89 mountPath: /tmp/coredump
90 {{- end }}
91 volumes:
92 - name: cp-script
93 configMap:
94 name: gnbsim
95 defaultMode: 493
96 - name: cp-config
97 configMap:
98 name: gnbsim
99 defaultMode: 420
100 {{- if .Values.config.coreDump.enabled }}
101 - name: host-rootfs
102 hostPath:
103 path: /
104 - name: coredump
105 hostPath:
106 path: {{ .Values.config.coreDump.path }}
107 {{- end }}
108{{- end }}