blob: 44683f8e97ab18375d88699aa9e2ea84ed7baaeb [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.nrf.deploy }}
8{{ tuple "nrf" . | include "5g-control-plane.service_account" }}
9---
10apiVersion: apps/v1
11kind: StatefulSet
12metadata:
13 name: nrf
14 labels:
15{{ tuple "nrf" . | include "5g-control-plane.metadata_labels" | indent 4 }}
16spec:
17 replicas: 1
18 serviceName: nrf-headless
19 selector:
20 matchLabels:
21{{ tuple "nrf" . | include "5g-control-plane.metadata_labels" | indent 6 }}
22 template:
23 metadata:
24 labels:
25{{ tuple "nrf" . | include "5g-control-plane.metadata_labels" | indent 8 }}
26 {{- with .Values.config.nrf.podAnnotations }}
27 annotations:
28 helm.sh/hook: pre-install
29 helm.sh/hook-weight: "2"
30 {{- toYaml . | nindent 8 }}
31 {{- end }}
32 spec:
33 {{- if .Values.nodeSelectors.enabled }}
34 nodeSelector:
35 {{ .Values.nodeSelectors.nrf.label }}: {{ .Values.nodeSelectors.nrf.value }}
36 {{- end }}
37 serviceAccountName: nrf
38 {{- if .Values.images.credentials }}
39 imagePullSecrets:
40 - name: {{ .Release.Name }}.registry
41 {{- end }}
42 {{- if .Values.config.coreDump.enabled }}
43 initContainers:
44{{ tuple "nrf" . | include "5g-control-plane.coredump_init" | indent 6 }}
45 {{- end }}
46 containers:
47 - name: nrf
48 image: {{ .Values.images.tags.nrf }}
49 imagePullPolicy: {{ .Values.images.pullPolicy }}
50 {{- if .Values.config.coreDump.enabled }}
51 securityContext:
52 runAsUser: 0
53 {{- end }}
54 stdin: true
55 tty: true
56 command: ["/opt/cp/scripts/nrf-run.sh"]
57 env:
58 - name: POD_IP
59 valueFrom:
60 fieldRef:
61 fieldPath: status.podIP
62 {{- if .Values.resources.enabled }}
63 resources:
64{{ toYaml .Values.resources.nrf | indent 10 }}
65 {{- end }}
66 volumeMounts:
67 - name: cp-script
68 mountPath: /opt/cp/scripts/nrf-run.sh
69 subPath: nrf-run.sh
70 - name: cp-config
71 mountPath: /free5gc/config
72 {{- if .Values.config.coreDump.enabled }}
73 - name: coredump
74 mountPath: /tmp/coredump
75 {{- end }}
76 volumes:
77 - name: cp-script
78 configMap:
79 name: nrf
80 defaultMode: 493
81 - name: cp-config
82 configMap:
83 name: nrf
84 defaultMode: 493
85 {{- if .Values.config.coreDump.enabled }}
86 - name: host-rootfs
87 hostPath:
88 path: /
89 - name: coredump
90 hostPath:
91 path: {{ .Values.config.coreDump.path }}
92 {{- end }}
93{{- end }}