blob: 438b794f077f3d97d373dd56e1c0f0b1ea0a967b [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{/*
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002# Copyright 2019-present Open Networking Foundation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07004# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07005*/}}
6
Hyunsun Moon83ff7352020-07-09 11:03:52 -07007{{- if .Values.config.spgwc.deploy }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -07008{{ tuple "spgwc" . | include "omec-control-plane.service_account" }}
9---
10apiVersion: apps/v1
11kind: StatefulSet
12metadata:
13 name: spgwc
14 labels:
15{{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 4 }}
16spec:
17 replicas: 1
18 serviceName: spgwc-headless
19 selector:
20 matchLabels:
21{{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 6 }}
22 template:
23 metadata:
24 labels:
25{{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 8 }}
Andy Bavierba196552020-09-17 13:58:04 -070026 {{- with .Values.config.spgwc.podAnnotations }}
27 annotations:
28 {{- toYaml . | nindent 8 }}
29 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070030 spec:
31 {{- if .Values.nodeSelectors.enabled }}
32 nodeSelector:
33 {{ .Values.nodeSelectors.spgwc.label }}: {{ .Values.nodeSelectors.spgwc.value }}
34 {{- end }}
35 serviceAccountName: spgwc
Hyunsun Moond9a09e82021-03-17 12:16:53 -070036 {{- if hasKey .Values.images "pullSecrets" }}
Hyunsun Moon8da17882020-10-14 21:28:44 -050037 imagePullSecrets:
Hyunsun Moond9a09e82021-03-17 12:16:53 -070038{{ toYaml .Values.images.pullSecrets | indent 8 }}
Hyunsun Moon8da17882020-10-14 21:28:44 -050039 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070040 {{- if .Values.config.coreDump.enabled }}
Hyunsun Moon7f03a772020-09-27 23:23:50 -050041 initContainers:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070042{{ tuple "spgwc" . | include "omec-control-plane.coredump_init" | indent 6 }}
43 {{- end }}
44 containers:
45 - name: spgwc
46 image: {{ .Values.images.tags.spgwc }}
47 imagePullPolicy: {{ .Values.images.pullPolicy }}
48 {{- if .Values.config.coreDump.enabled }}
49 securityContext:
50 privileged: true
51 runAsUser: 0
52 {{- end }}
53 stdin: true
54 tty: true
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -050055 command: ["bash", "-xc"]
56 args:
57 - /opt/cp/scripts/spgwc-run.sh ngic_controlplane
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050058 livenessProbe:
59 httpGet:
60 path: /liveness
Hyunsun Moon7f03a772020-09-27 23:23:50 -050061 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050062 initialDelaySeconds: 10
63 periodSeconds: 3
64 readinessProbe:
65 httpGet:
66 path: /readiness
Hyunsun Moon7f03a772020-09-27 23:23:50 -050067 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050068 initialDelaySeconds: 10
69 periodSeconds: 3
70{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
71 startupProbe:
72 #looks like available only in 1.16 K8s version and above
73 httpGet:
74 path: /startup
Hyunsun Moon7f03a772020-09-27 23:23:50 -050075 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050076 failureThreshold: 30
77 periodSeconds: 10
78{{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070079 env:
80 - name: MEM_LIMIT
81 valueFrom:
82 resourceFieldRef:
83 containerName: spgwc
84 resource: limits.memory
85 divisor: 1Mi
86 - name: POD_IP
87 valueFrom:
88 fieldRef:
89 fieldPath: status.podIP
Andy Bavier1a2d8f52021-06-04 16:04:17 -070090 {{- if .Values.config.spgwc.managedByRoc.enabled }}
Andy Bavier6778fff2021-05-28 15:35:07 -070091 - name: DISABLE_CONFIG_WATCHER # If the variable has a value then changes
92 value: "true" # to subscriber_mapping.json are ignored
93 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070094 {{- if .Values.resources.enabled }}
95 resources:
96{{ toYaml .Values.resources.spgwc | indent 10 }}
97 {{- end }}
98 volumeMounts:
Hyunsun Moon1fc24472021-03-14 19:10:11 -050099 - name: scripts
100 mountPath: /opt/cp/scripts
101 - name: configs
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700102 mountPath: /etc/cp/config
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500103 - name: shared-app
104 mountPath: /tmp
105 {{- if .Values.config.coreDump.enabled }}
106 - name: coredump
107 mountPath: /tmp/coredump
108 {{- end }}
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500109 - name: gx-app
110 image: {{ .Values.images.tags.spgwc }}
111 imagePullPolicy: {{ .Values.images.pullPolicy }}
112 {{- if .Values.config.coreDump.enabled }}
113 securityContext:
114 privileged: true
115 runAsUser: 0
116 {{- end }}
117 stdin: true
118 tty: true
119 command: ["bash", "-xc"]
120 args:
121 - /opt/cp/scripts/spgwc-run.sh gx-app
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500122 {{- if .Values.resources.enabled }}
123 resources:
124{{ toYaml .Values.resources.spgwc | indent 10 }}
125 {{- end }}
126 volumeMounts:
Hyunsun Moon1fc24472021-03-14 19:10:11 -0500127 - name: scripts
128 mountPath: /opt/cp/scripts
129 - name: configs
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500130 mountPath: /etc/cp/config
131 - name: shared-app
132 mountPath: /tmp
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700133 {{- if .Values.config.coreDump.enabled }}
134 - name: coredump
135 mountPath: /tmp/coredump
136 {{- end }}
Andy Bavier1a2d8f52021-06-04 16:04:17 -0700137 {{- if .Values.config.spgwc.managedByRoc.enabled }}
138 - name: init-sync
139 image: curlimages/curl:7.77.0
140 imagePullPolicy: IfNotPresent
141 stdin: true
142 tty: true
143 command: ["sh", "-c"]
144 args:
145 - /opt/cp/scripts/spgwc-init.sh
146 volumeMounts:
147 - name: scripts
148 mountPath: /opt/cp/scripts
149 volumes:
150 - name: scripts
151 configMap:
152 name: spgwc-scripts
153 defaultMode: 493
154 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700155 volumes:
Hyunsun Moon1fc24472021-03-14 19:10:11 -0500156 - name: scripts
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700157 configMap:
Hyunsun Moon1fc24472021-03-14 19:10:11 -0500158 name: spgwc-scripts
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700159 defaultMode: 493
Hyunsun Moon1fc24472021-03-14 19:10:11 -0500160 - name: configs
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700161 configMap:
Hyunsun Moon1fc24472021-03-14 19:10:11 -0500162 name: spgwc-configs
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700163 defaultMode: 420
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500164 - name: shared-app
165 emptyDir: {}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700166 - name: host-rootfs
167 hostPath:
168 path: /
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -0500169 {{- if .Values.config.coreDump.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700170 - name: coredump
171 hostPath:
172 path: {{ .Values.config.coreDump.path }}
173 {{- end }}
Hyunsun Moon83ff7352020-07-09 11:03:52 -0700174{{- end }}