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: '[ |
| 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 }} |
| 33 | "ips": [{{ .Values.config.gnbsim.gnb.ip | quote }}] |
| 34 | {{- else }} |
| 35 | "ips": {{ .Values.config.gnbsim.gnb.ip | quote }} |
| 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 }} |
| 50 | |
| 51 | initContainers: |
| 52 | - name: wait-amf-module |
Ajay Lotan Thakur | 71115fe | 2022-03-03 22:26:08 -0700 | [diff] [blame] | 53 | image: {{ .Values.images.repository }}{{ .Values.images.tags.init }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 54 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 55 | command: ['sh', '-c', 'until nslookup amf; do echo waiting for nrf; sleep 4; done;'] |
| 56 | {{- if .Values.config.coreDump.enabled }} |
| 57 | {{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }} |
| 58 | {{- end }} |
| 59 | containers: |
| 60 | - name: gnbsim |
Ajay Lotan Thakur | 71115fe | 2022-03-03 22:26:08 -0700 | [diff] [blame] | 61 | image: {{ .Values.images.repository }}{{ .Values.images.tags.gnbsim }} |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 62 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 63 | securityContext: |
| 64 | privileged: true |
| 65 | runAsUser: 0 |
| 66 | stdin: true |
| 67 | tty: true |
| 68 | command: ["/opt/cp/scripts/gnbsim-run.sh"] |
| 69 | env: |
| 70 | - name: MEM_LIMIT |
| 71 | valueFrom: |
| 72 | resourceFieldRef: |
| 73 | containerName: gnbsim |
| 74 | resource: limits.memory |
| 75 | divisor: 1Mi |
| 76 | - name: POD_IP |
| 77 | valueFrom: |
| 78 | fieldRef: |
| 79 | fieldPath: status.podIP |
| 80 | {{- if .Values.resources.enabled }} |
| 81 | resources: |
| 82 | {{ toYaml .Values.resources.gnbsim | indent 10 }} |
| 83 | {{- end }} |
| 84 | volumeMounts: |
| 85 | - name: cp-script |
| 86 | mountPath: /opt/cp/scripts/gnbsim-run.sh |
| 87 | subPath: gnbsim-run.sh |
| 88 | - name: cp-config |
Ajay Lotan Thakur | 4ebd7e8 | 2022-01-14 09:11:42 -0700 | [diff] [blame] | 89 | mountPath: /gnbsim/config |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 90 | {{- if .Values.config.coreDump.enabled }} |
| 91 | - name: coredump |
| 92 | mountPath: /tmp/coredump |
| 93 | {{- end }} |
| 94 | volumes: |
| 95 | - name: cp-script |
| 96 | configMap: |
| 97 | name: gnbsim |
| 98 | defaultMode: 493 |
| 99 | - name: cp-config |
| 100 | configMap: |
| 101 | name: gnbsim |
| 102 | defaultMode: 420 |
| 103 | {{- if .Values.config.coreDump.enabled }} |
| 104 | - name: host-rootfs |
| 105 | hostPath: |
| 106 | path: / |
| 107 | - name: coredump |
| 108 | hostPath: |
| 109 | path: {{ .Values.config.coreDump.path }} |
| 110 | {{- end }} |
| 111 | {{- end }} |