Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | {{/* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | # Copyright 2019-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | */}} |
| 6 | |
Hyunsun Moon | 83ff735 | 2020-07-09 11:03:52 -0700 | [diff] [blame] | 7 | {{- if .Values.config.spgwc.deploy }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 8 | {{ tuple "spgwc" . | include "omec-control-plane.service_account" }} |
| 9 | --- |
| 10 | apiVersion: apps/v1 |
| 11 | kind: StatefulSet |
| 12 | metadata: |
| 13 | name: spgwc |
| 14 | labels: |
| 15 | {{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 4 }} |
| 16 | spec: |
| 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 Bavier | ba19655 | 2020-09-17 13:58:04 -0700 | [diff] [blame] | 26 | {{- with .Values.config.spgwc.podAnnotations }} |
| 27 | annotations: |
| 28 | {{- toYaml . | nindent 8 }} |
| 29 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 30 | spec: |
| 31 | {{- if .Values.nodeSelectors.enabled }} |
| 32 | nodeSelector: |
| 33 | {{ .Values.nodeSelectors.spgwc.label }}: {{ .Values.nodeSelectors.spgwc.value }} |
| 34 | {{- end }} |
| 35 | serviceAccountName: spgwc |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 36 | {{- if .Values.images.credentials }} |
| 37 | imagePullSecrets: |
| 38 | - name: {{ .Release.Name }}.registry |
| 39 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 40 | {{- if .Values.config.coreDump.enabled }} |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 41 | initContainers: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 42 | {{ 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 Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 56 | livenessProbe: |
| 57 | httpGet: |
| 58 | path: /liveness |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 59 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 60 | initialDelaySeconds: 10 |
| 61 | periodSeconds: 3 |
| 62 | readinessProbe: |
| 63 | httpGet: |
| 64 | path: /readiness |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 65 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 66 | 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 Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 73 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 74 | failureThreshold: 30 |
| 75 | periodSeconds: 10 |
| 76 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 77 | 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 Moon | 83ff735 | 2020-07-09 11:03:52 -0700 | [diff] [blame] | 119 | {{- end }} |