blob: 91fe84f524f7dde65d3292873209d1756140b4db [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 Moon8da17882020-10-14 21:28:44 -050036 {{- if .Values.images.credentials }}
37 imagePullSecrets:
38 - name: {{ .Release.Name }}.registry
39 {{- 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
55 command: ["/opt/cp/scripts/spgwc-run.sh"]
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050056 livenessProbe:
57 httpGet:
58 path: /liveness
Hyunsun Moon7f03a772020-09-27 23:23:50 -050059 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050060 initialDelaySeconds: 10
61 periodSeconds: 3
62 readinessProbe:
63 httpGet:
64 path: /readiness
Hyunsun Moon7f03a772020-09-27 23:23:50 -050065 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050066 initialDelaySeconds: 10
67 periodSeconds: 3
68{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
69 startupProbe:
70 #looks like available only in 1.16 K8s version and above
71 httpGet:
72 path: /startup
Hyunsun Moon7f03a772020-09-27 23:23:50 -050073 port: {{ .Values.config.spgwc.rest.port }}
Ajay Lotan Thakur97278fa2020-09-21 17:31:51 -050074 failureThreshold: 30
75 periodSeconds: 10
76{{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070077 env:
78 - name: MEM_LIMIT
79 valueFrom:
80 resourceFieldRef:
81 containerName: spgwc
82 resource: limits.memory
83 divisor: 1Mi
84 - name: POD_IP
85 valueFrom:
86 fieldRef:
87 fieldPath: status.podIP
88 {{- if .Values.resources.enabled }}
89 resources:
90{{ toYaml .Values.resources.spgwc | indent 10 }}
91 {{- end }}
92 volumeMounts:
93 - name: cp-script
94 mountPath: /opt/cp/scripts/spgwc-run.sh
95 subPath: spgwc-run.sh
96 - name: cp-config
97 mountPath: /etc/cp/config
98 {{- if .Values.config.coreDump.enabled }}
99 - name: coredump
100 mountPath: /tmp/coredump
101 {{- end }}
102 volumes:
103 - name: cp-script
104 configMap:
105 name: spgwc
106 defaultMode: 493
107 - name: cp-config
108 configMap:
109 name: spgwc
110 defaultMode: 420
111 {{- if .Values.config.coreDump.enabled }}
112 - name: host-rootfs
113 hostPath:
114 path: /
115 - name: coredump
116 hostPath:
117 path: {{ .Values.config.coreDump.path }}
118 {{- end }}
Hyunsun Moon83ff7352020-07-09 11:03:52 -0700119{{- end }}