Newer
Older
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
{{- include "oai-cu.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "oai-cu.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "oai-cu.selectorLabels" . | nindent 8 }}
app: oai-cu
{{- if .Values.multus.f1Interface.create }}
annotations:
k8s.v1.cni.cncf.io/networks: >-
[{
"name": "{{ .Chart.Name }}-{{ .Values.multus.f1Interface.name }}",
"interface": "{{ .Values.multus.f1Interface.name }}"
{{- if .Values.multus.f1Interface.mac }}
,"mac": "{{ .Values.multus.f1Interface.mac }}"
,"default-route": ["{{ .Values.multus.defaultGateway }}"]
{{- end }}
{{- if .Values.multus.f1Interface.gateway }}
,"gateway": "{{ .Values.multus.f1Interface.gateway }}"
{{- end }}
{{- if .Values.multus.n2Interface.create }}
,{
"name": "{{ .Chart.Name }}-{{ .Values.multus.n2Interface.name }}",
"interface": "{{ .Values.multus.n2Interface.name }}"
{{- if .Values.multus.n2Interface.mac }}
,"mac": "{{ .Values.multus.n2Interface.mac }}"
{{- if .Values.multus.n2Interface.gateway }}
,"gateway": "{{ .Values.multus.n2Interface.gateway }}"
{{- end }}
}
{{- end }}
{{- if .Values.multus.n3Interface.create }}
,{
"name": "{{ .Chart.Name }}-{{ .Values.multus.n3Interface.name }}",
"interface": "{{ .Values.multus.n3Interface.name }}"
{{- if .Values.multus.n3Interface.mac }}
,"mac": "{{ .Values.multus.n3Interface.mac }}"
{{- if .Values.multus.n3Interface.gateway }}
,"gateway": "{{ .Values.multus.n3Interface.gateway }}"
}
{{- end }}
]
{{- end }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.global }}{{ if .Values.global.waitForAMF }}
initContainers:
- name: init
image: docker.io/oaisoftwarealliance/oai-tcpdump-init:alpine-3.20
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- until ncat -zv {{ .Values.config.amfhost }} 38412 --sctp ; do echo waiting for oai-amf to start; sleep 1; done
resources:
requests:
memory: 50Mi
cpu: 1m
limits:
memory: 50Mi
cpu: 1m
{{- end }}{{ end }}
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /opt/oai-gnb/etc
name: configuration
{{- if .Values.resources.define}}
resources:
requests:
memory: {{ .Values.resources.requests.nf.memory | quote }}
cpu: {{ .Values.resources.requests.nf.cpu | quote }}
limits:
memory: {{ .Values.resources.limits.nf.memory | quote }}
cpu: {{ .Values.resources.limits.nf.cpu | quote }}
{{- end}}
ports:
- containerPort: 2152
name: n3
protocol: UDP
- containerPort: 36412
name: n2
protocol: SCTP
- containerPort: {{ .Values.config.f1cuPort }}
name: f1
protocol: UDP
AMF_IP_ADDRESS=$(if [[ $AMF_IP_ADDRESS ]]; then echo $AMF_IP_ADDRESS; else echo $AMF_HOST;fi)
N2_IP_ADDRESS=$(ip -4 addr show $N2_IF_NAME | grep inet | awk '{ print $2 }' | cut -d/ -f1);
N3_IP_ADDRESS=$(ip -4 addr show $N3_IF_NAME | grep inet | awk '{ print $2 }' | cut -d/ -f1);
F1_IP_ADDRESS=$(ip -4 addr show $F1_IF_NAME | grep inet | awk '{ print $2 }' | cut -d/ -f1);
sed -e s/@AMF_IP_ADDRESS@/$AMF_IP_ADDRESS/g
-e s/@N2_IP_ADDRESS@/$N2_IP_ADDRESS/g
-e s/@N3_IP_ADDRESS@/$N3_IP_ADDRESS/g
-e s/@F1_IP_ADDRESS@/$F1_IP_ADDRESS/g
/opt/oai-gnb/etc/cu.conf | tee /tmp/cu.conf;
exec /opt/oai-gnb/bin/nr-softmodem -O /tmp/cu.conf $USE_ADDITIONAL_OPTIONS;
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
env:
- name: TZ
value: {{ .Values.config.timeZone }}
- name: USE_ADDITIONAL_OPTIONS
value: {{ .Values.config.useAdditionalOptions }}
- name: OAI_GDBSTACKS
value: "1"
- name: AMF_HOST
value: {{ .Values.config.amfHost }}
- name: N2_IF_NAME
value: {{ .Values.config.n2IfName }}
- name: N3_IF_NAME
value: {{ .Values.config.n3IfName }}
- name: F1_IF_NAME
value: {{ .Values.config.f1IfName }}
{{- if .Values.includeTcpDumpContainer }}
- name: tcpdump
image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
imagePullPolicy: {{ .Values.tcpdumpimage.pullPolicy }}
{{- if .Values.resources.define}}
resources:
requests:
memory: {{ .Values.resources.requests.tcpdump.memory | quote }}
cpu: {{ .Values.resources.requests.tcpdump.cpu | quote }}
limits:
memory: {{ .Values.resources.limits.tcpdump.memory | quote }}
cpu: {{ .Values.resources.limits.tcpdump.cpu | quote }}
{{- end}}
securityContext:
capabilities:
add:
- NET_ADMIN
drop:
- ALL
{{- if .Values.start.tcpdump}}
command:
- /bin/sh
- -c
- /usr/bin/tcpdump -i any -w /tmp/pcap/{{ .Chart.Name }}_`date +%Y-%m-%d_%H_%M-%S-%Z`.pcap
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
{{- if .Values.persistent.sharedvolume }}
- name: oai5g-pv
persistentVolumeClaim:
claimName: oai5g-pvc
- configMap:
name: {{ .Chart.Name }}-configmap
name: configuration
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
serviceAccountName: {{ .Values.serviceAccount.name }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.nodeSelector}}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 12 }}
{{- end }}
{{- if .Values.nodeName}}
nodeName: {{ .Values.nodeName }}
{{- end }}