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 }} |
| 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 hasKey .Values.images "pullSecrets" }} |
| 45 | imagePullSecrets: |
| 46 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
| 47 | {{- end }} |
| 48 | |
| 49 | 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 |
Ajay Lotan Thakur | 4ebd7e8 | 2022-01-14 09:11:42 -0700 | [diff] [blame] | 87 | mountPath: /gnbsim/config |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 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 }} |