blob: 6269c3f8740a890ca1cf403b53a173a64c68ff4d [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
Jeremy Ronquillo223db002020-06-05 10:28:22 -070036 {{- if .Values.config.coreDump.enabled }}
Hyunsun Moon7f03a772020-09-27 23:23:50 -050037 initContainers:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070038{{ tuple "spgwc" . | include "omec-control-plane.coredump_init" | indent 6 }}
39 {{- end }}
40 containers:
41 - name: spgwc
42 image: {{ .Values.images.tags.spgwc }}
43 imagePullPolicy: {{ .Values.images.pullPolicy }}
44 {{- if .Values.config.coreDump.enabled }}
45 securityContext:
46 privileged: true
47 runAsUser: 0
48 {{- end }}
49 stdin: true
50 tty: true
51 command: ["/opt/cp/scripts/spgwc-run.sh"]
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050052 livenessProbe:
53 httpGet:
54 path: /liveness
Hyunsun Moon7f03a772020-09-27 23:23:50 -050055 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050056 initialDelaySeconds: 10
57 periodSeconds: 3
58 readinessProbe:
59 httpGet:
60 path: /readiness
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{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
65 startupProbe:
66 #looks like available only in 1.16 K8s version and above
67 httpGet:
68 path: /startup
Hyunsun Moon7f03a772020-09-27 23:23:50 -050069 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050070 failureThreshold: 30
71 periodSeconds: 10
72{{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070073 env:
74 - name: MEM_LIMIT
75 valueFrom:
76 resourceFieldRef:
77 containerName: spgwc
78 resource: limits.memory
79 divisor: 1Mi
80 - name: POD_IP
81 valueFrom:
82 fieldRef:
83 fieldPath: status.podIP
84 {{- if .Values.resources.enabled }}
85 resources:
86{{ toYaml .Values.resources.spgwc | indent 10 }}
87 {{- end }}
88 volumeMounts:
89 - name: cp-script
90 mountPath: /opt/cp/scripts/spgwc-run.sh
91 subPath: spgwc-run.sh
92 - name: cp-config
93 mountPath: /etc/cp/config
94 {{- if .Values.config.coreDump.enabled }}
95 - name: coredump
96 mountPath: /tmp/coredump
97 {{- end }}
98 volumes:
99 - name: cp-script
100 configMap:
101 name: spgwc
102 defaultMode: 493
103 - name: cp-config
104 configMap:
105 name: spgwc
106 defaultMode: 420
107 {{- if .Values.config.coreDump.enabled }}
108 - name: host-rootfs
109 hostPath:
110 path: /
111 - name: coredump
112 hostPath:
113 path: {{ .Values.config.coreDump.path }}
114 {{- end }}
Hyunsun Moon83ff7352020-07-09 11:03:52 -0700115{{- end }}