badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2020-present Open Networking Foundation |
| 3 | |
Ajay Lotan Thakur | 03189d2 | 2022-02-10 14:06:03 -0600 | [diff] [blame] | 4 | # SPDX-License-Identifier: Apache-2.0 |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 5 | */}} |
| 6 | |
| 7 | {{- if .Values.config.gnbsim.deploy }} |
| 8 | {{ tuple "gnbsim" . | include "5g-ransim-plane.service_account" }} |
| 9 | --- |
| 10 | apiVersion: apps/v1 |
| 11 | kind: StatefulSet |
| 12 | metadata: |
| 13 | name: gnbsim |
| 14 | labels: |
| 15 | {{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }} |
| 16 | spec: |
| 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 Thakur | 0203c3b | 2022-03-21 13:40:11 -0600 | [diff] [blame] | 26 | {{- if not .Values.config.gnbsim.singleInterface }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 27 | annotations: |
| 28 | k8s.v1.cni.cncf.io/networks: '[ |
Vijaya Tiruveedula | 56f595f | 2022-10-27 05:28:50 -0600 | [diff] [blame] | 29 | { |
Hyunsun Moon | 2b21eb4 | 2022-03-24 01:52:22 -0600 | [diff] [blame] | 30 | "name": "gnb-net", |
| 31 | "interface": "gnb", |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 32 | {{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }} |
Vijaya Tiruveedula | 56f595f | 2022-10-27 05:28:50 -0600 | [diff] [blame] | 33 | "ips": [ {{ include "gnbiplist" .}} ] |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 34 | {{- else }} |
Badhrinath Padmanabhan | b8f4291 | 2022-11-16 13:58:04 -0500 | [diff] [blame] | 35 | "ips": {{ .Values.config.gnbsim.gnb.ips | quote }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 36 | {{- end }} |
| 37 | } |
| 38 | ]' |
Ajay Lotan Thakur | 0203c3b | 2022-03-21 13:40:11 -0600 | [diff] [blame] | 39 | {{- end }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 40 | 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 Thakur | d925212 | 2022-08-30 22:35:59 +0000 | [diff] [blame] | 50 | initContainers: |
Badhrinath Padmanabhan | a0c93b7 | 2022-11-21 21:53:00 -0600 | [diff] [blame] | 51 | {{- if .Values.config.gnbsim.waitForAmf }} |
Ajay Lotan Thakur | eadf770 | 2022-09-30 00:02:58 -0600 | [diff] [blame] | 52 | - name: wait-amf-module |
| 53 | image: {{ .Values.images.repository }}{{ .Values.images.tags.init }} |
| 54 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
Badhrinath Padmanabhan | a0c93b7 | 2022-11-21 21:53:00 -0600 | [diff] [blame] | 55 | command: ['sh', '-c', 'until nslookup amf; do echo waiting for amf; sleep 4; done; sleep 20'] |
Badhrinath Padmanabhan | b8f4291 | 2022-11-16 13:58:04 -0500 | [diff] [blame] | 56 | {{- end }} |
Ajay Lotan Thakur | eadf770 | 2022-09-30 00:02:58 -0600 | [diff] [blame] | 57 | {{- if .Values.config.coreDump.enabled }} |
Ajay Lotan Thakur | d925212 | 2022-08-30 22:35:59 +0000 | [diff] [blame] | 58 | {{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 59 | {{- end }} |
| 60 | containers: |
| 61 | - name: gnbsim |
Ajay Lotan Thakur | 71115fe | 2022-03-03 22:26:08 -0700 | [diff] [blame] | 62 | image: {{ .Values.images.repository }}{{ .Values.images.tags.gnbsim }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 63 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 64 | securityContext: |
| 65 | privileged: true |
| 66 | runAsUser: 0 |
| 67 | stdin: true |
| 68 | tty: true |
| 69 | command: ["/opt/cp/scripts/gnbsim-run.sh"] |
| 70 | env: |
| 71 | - name: MEM_LIMIT |
| 72 | valueFrom: |
| 73 | resourceFieldRef: |
| 74 | containerName: gnbsim |
| 75 | resource: limits.memory |
| 76 | divisor: 1Mi |
| 77 | - name: POD_IP |
| 78 | valueFrom: |
| 79 | fieldRef: |
| 80 | fieldPath: status.podIP |
Badhrinath Padmanabhan | b8f4291 | 2022-11-16 13:58:04 -0500 | [diff] [blame] | 81 | {{- if or .Values.resources.enabled .Values.config.gnbsim.sriov.enabled }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 82 | resources: |
| 83 | {{ toYaml .Values.resources.gnbsim | indent 10 }} |
Badhrinath Padmanabhan | b8f4291 | 2022-11-16 13:58:04 -0500 | [diff] [blame] | 84 | {{- if .Values.config.gnbsim.sriov.enabled }} |
| 85 | requests: |
| 86 | {{ .Values.config.gnbsim.sriov.resourceName }}: 1 |
| 87 | limits: |
| 88 | {{ .Values.config.gnbsim.sriov.resourceName }}: 1 |
| 89 | {{- end }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 90 | {{- end }} |
| 91 | volumeMounts: |
| 92 | - name: cp-script |
| 93 | mountPath: /opt/cp/scripts/gnbsim-run.sh |
| 94 | subPath: gnbsim-run.sh |
| 95 | - name: cp-config |
Ajay Lotan Thakur | 4ebd7e8 | 2022-01-14 09:11:42 -0700 | [diff] [blame] | 96 | mountPath: /gnbsim/config |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 97 | {{- if .Values.config.coreDump.enabled }} |
| 98 | - name: coredump |
| 99 | mountPath: /tmp/coredump |
| 100 | {{- end }} |
| 101 | volumes: |
| 102 | - name: cp-script |
| 103 | configMap: |
| 104 | name: gnbsim |
| 105 | defaultMode: 493 |
| 106 | - name: cp-config |
| 107 | configMap: |
| 108 | name: gnbsim |
| 109 | defaultMode: 420 |
| 110 | {{- if .Values.config.coreDump.enabled }} |
| 111 | - name: host-rootfs |
| 112 | hostPath: |
| 113 | path: / |
| 114 | - name: coredump |
| 115 | hostPath: |
| 116 | path: {{ .Values.config.coreDump.path }} |
| 117 | {{- end }} |
| 118 | {{- end }} |