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 | d9a09e8 | 2021-03-17 12:16:53 -0700 | [diff] [blame] | 36 | {{- if hasKey .Values.images "pullSecrets" }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 37 | imagePullSecrets: |
Hyunsun Moon | d9a09e8 | 2021-03-17 12:16:53 -0700 | [diff] [blame] | 38 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 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 |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 55 | command: ["bash", "-xc"] |
| 56 | args: |
| 57 | - /opt/cp/scripts/spgwc-run.sh ngic_controlplane |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 58 | livenessProbe: |
| 59 | httpGet: |
| 60 | path: /liveness |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 61 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 62 | initialDelaySeconds: 10 |
| 63 | periodSeconds: 3 |
| 64 | readinessProbe: |
| 65 | httpGet: |
| 66 | path: /readiness |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 67 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 68 | 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 Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 75 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | 97278fa | 2020-09-21 17:31:51 -0500 | [diff] [blame] | 76 | failureThreshold: 30 |
| 77 | periodSeconds: 10 |
| 78 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 79 | 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 |
Ajay Lotan Thakur | 71f26c5 | 2021-08-19 17:04:02 -0500 | [diff] [blame] | 90 | {{- if .Values.config.managedByConfigPod.enabled }} |
| 91 | - name: MANAGED_BY_CONFIG_POD |
| 92 | value: "true" |
| 93 | {{- end }} |
Andy Bavier | 1a2d8f5 | 2021-06-04 16:04:17 -0700 | [diff] [blame] | 94 | {{- if .Values.config.spgwc.managedByRoc.enabled }} |
Andy Bavier | 6778fff | 2021-05-28 15:35:07 -0700 | [diff] [blame] | 95 | - name: DISABLE_CONFIG_WATCHER # If the variable has a value then changes |
| 96 | value: "true" # to subscriber_mapping.json are ignored |
| 97 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 98 | {{- if .Values.resources.enabled }} |
| 99 | resources: |
| 100 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 101 | {{- end }} |
| 102 | volumeMounts: |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 103 | - name: scripts |
| 104 | mountPath: /opt/cp/scripts |
| 105 | - name: configs |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 106 | mountPath: /etc/cp/config |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 107 | - name: shared-app |
| 108 | mountPath: /tmp |
| 109 | {{- if .Values.config.coreDump.enabled }} |
| 110 | - name: coredump |
| 111 | mountPath: /tmp/coredump |
| 112 | {{- end }} |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 113 | - name: gx-app |
| 114 | image: {{ .Values.images.tags.spgwc }} |
| 115 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 116 | {{- if .Values.config.coreDump.enabled }} |
| 117 | securityContext: |
| 118 | privileged: true |
| 119 | runAsUser: 0 |
| 120 | {{- end }} |
| 121 | stdin: true |
| 122 | tty: true |
| 123 | command: ["bash", "-xc"] |
| 124 | args: |
| 125 | - /opt/cp/scripts/spgwc-run.sh gx-app |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 126 | {{- if .Values.resources.enabled }} |
| 127 | resources: |
| 128 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 129 | {{- end }} |
| 130 | volumeMounts: |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 131 | - name: scripts |
| 132 | mountPath: /opt/cp/scripts |
| 133 | - name: configs |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 134 | mountPath: /etc/cp/config |
| 135 | - name: shared-app |
| 136 | mountPath: /tmp |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 137 | {{- if .Values.config.coreDump.enabled }} |
| 138 | - name: coredump |
| 139 | mountPath: /tmp/coredump |
| 140 | {{- end }} |
Andy Bavier | 1a2d8f5 | 2021-06-04 16:04:17 -0700 | [diff] [blame] | 141 | {{- if .Values.config.spgwc.managedByRoc.enabled }} |
| 142 | - name: init-sync |
| 143 | image: curlimages/curl:7.77.0 |
| 144 | imagePullPolicy: IfNotPresent |
| 145 | stdin: true |
| 146 | tty: true |
| 147 | command: ["sh", "-c"] |
| 148 | args: |
| 149 | - /opt/cp/scripts/spgwc-init.sh |
| 150 | volumeMounts: |
| 151 | - name: scripts |
| 152 | mountPath: /opt/cp/scripts |
| 153 | volumes: |
| 154 | - name: scripts |
| 155 | configMap: |
| 156 | name: spgwc-scripts |
| 157 | defaultMode: 493 |
| 158 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 159 | volumes: |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 160 | - name: scripts |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 161 | configMap: |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 162 | name: spgwc-scripts |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 163 | defaultMode: 493 |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 164 | - name: configs |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 165 | configMap: |
Hyunsun Moon | 1fc2447 | 2021-03-14 19:10:11 -0500 | [diff] [blame] | 166 | name: spgwc-configs |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 167 | defaultMode: 420 |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 168 | - name: shared-app |
| 169 | emptyDir: {} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 170 | - name: host-rootfs |
| 171 | hostPath: |
| 172 | path: / |
Ajay Lotan Thakur | c3cd619 | 2020-10-12 20:12:38 -0500 | [diff] [blame] | 173 | {{- if .Values.config.coreDump.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 174 | - name: coredump |
| 175 | hostPath: |
| 176 | path: {{ .Values.config.coreDump.path }} |
| 177 | {{- end }} |
Hyunsun Moon | 83ff735 | 2020-07-09 11:03:52 -0700 | [diff] [blame] | 178 | {{- end }} |