badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2019-present Open Networking Foundation |
| 3 | |
Ajay Lotan Thakur | 03189d2 | 2022-02-10 14:06:03 -0600 | [diff] [blame] | 4 | # SPDX-License-Identifier: Apache-2.0 |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 5 | */}} |
| 6 | |
| 7 | {{- if .Values.config.spgwc.deploy }} |
| 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 }} |
| 26 | {{- with .Values.config.spgwc.podAnnotations }} |
| 27 | annotations: |
| 28 | {{- toYaml . | nindent 8 }} |
| 29 | {{- end }} |
| 30 | spec: |
| 31 | {{- if .Values.nodeSelectors.enabled }} |
| 32 | nodeSelector: |
| 33 | {{ .Values.nodeSelectors.spgwc.label }}: {{ .Values.nodeSelectors.spgwc.value }} |
| 34 | {{- end }} |
| 35 | serviceAccountName: spgwc |
| 36 | {{- if hasKey .Values.images "pullSecrets" }} |
| 37 | imagePullSecrets: |
| 38 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
| 39 | {{- end }} |
| 40 | {{- if .Values.config.coreDump.enabled }} |
| 41 | initContainers: |
| 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: ["bash", "-xc"] |
| 56 | args: |
| 57 | - /opt/cp/scripts/spgwc-run.sh ngic_controlplane |
| 58 | livenessProbe: |
| 59 | httpGet: |
| 60 | path: /liveness |
| 61 | port: {{ .Values.config.spgwc.rest.port }} |
| 62 | initialDelaySeconds: 10 |
| 63 | periodSeconds: 3 |
| 64 | readinessProbe: |
| 65 | httpGet: |
| 66 | path: /readiness |
| 67 | port: {{ .Values.config.spgwc.rest.port }} |
| 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 |
| 75 | port: {{ .Values.config.spgwc.rest.port }} |
Ajay Lotan Thakur | fe716c9 | 2021-11-23 01:51:38 -0600 | [diff] [blame] | 76 | initialDelaySeconds: 20 |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 77 | failureThreshold: 30 |
| 78 | periodSeconds: 10 |
| 79 | {{- end }} |
| 80 | env: |
| 81 | - name: MEM_LIMIT |
| 82 | valueFrom: |
| 83 | resourceFieldRef: |
| 84 | containerName: spgwc |
| 85 | resource: limits.memory |
| 86 | divisor: 1Mi |
| 87 | - name: POD_IP |
| 88 | valueFrom: |
| 89 | fieldRef: |
| 90 | fieldPath: status.podIP |
| 91 | {{- if .Values.config.managedByConfigPod.enabled }} |
| 92 | - name: MANAGED_BY_CONFIG_POD |
| 93 | value: "true" |
| 94 | {{- end }} |
| 95 | {{- if .Values.config.spgwc.managedByRoc.enabled }} |
| 96 | - name: DISABLE_CONFIG_WATCHER # If the variable has a value then changes |
| 97 | value: "true" # to subscriber_mapping.json are ignored |
| 98 | {{- end }} |
| 99 | {{- if .Values.resources.enabled }} |
| 100 | resources: |
| 101 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 102 | {{- end }} |
| 103 | volumeMounts: |
| 104 | - name: scripts |
| 105 | mountPath: /opt/cp/scripts |
| 106 | - name: configs |
| 107 | mountPath: /etc/cp/config |
| 108 | - name: shared-app |
| 109 | mountPath: /tmp |
| 110 | {{- if .Values.config.coreDump.enabled }} |
| 111 | - name: coredump |
| 112 | mountPath: /tmp/coredump |
| 113 | {{- end }} |
| 114 | - name: gx-app |
| 115 | image: {{ .Values.images.tags.spgwc }} |
| 116 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 117 | {{- if .Values.config.coreDump.enabled }} |
| 118 | securityContext: |
| 119 | privileged: true |
| 120 | runAsUser: 0 |
| 121 | {{- end }} |
| 122 | stdin: true |
| 123 | tty: true |
| 124 | command: ["bash", "-xc"] |
| 125 | args: |
| 126 | - /opt/cp/scripts/spgwc-run.sh gx-app |
| 127 | {{- if .Values.resources.enabled }} |
| 128 | resources: |
| 129 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 130 | {{- end }} |
| 131 | volumeMounts: |
| 132 | - name: scripts |
| 133 | mountPath: /opt/cp/scripts |
| 134 | - name: configs |
| 135 | mountPath: /etc/cp/config |
| 136 | - name: shared-app |
| 137 | mountPath: /tmp |
| 138 | {{- if .Values.config.coreDump.enabled }} |
| 139 | - name: coredump |
| 140 | mountPath: /tmp/coredump |
| 141 | {{- end }} |
| 142 | {{- if .Values.config.spgwc.managedByRoc.enabled }} |
| 143 | - name: init-sync |
| 144 | image: curlimages/curl:7.77.0 |
| 145 | imagePullPolicy: IfNotPresent |
| 146 | stdin: true |
| 147 | tty: true |
| 148 | command: ["sh", "-c"] |
| 149 | args: |
| 150 | - /opt/cp/scripts/spgwc-init.sh |
| 151 | volumeMounts: |
| 152 | - name: scripts |
| 153 | mountPath: /opt/cp/scripts |
| 154 | volumes: |
| 155 | - name: scripts |
| 156 | configMap: |
| 157 | name: spgwc-scripts |
| 158 | defaultMode: 493 |
| 159 | {{- end }} |
| 160 | volumes: |
| 161 | - name: scripts |
| 162 | configMap: |
| 163 | name: spgwc-scripts |
| 164 | defaultMode: 493 |
| 165 | - name: configs |
| 166 | configMap: |
| 167 | name: spgwc-configs |
| 168 | defaultMode: 420 |
| 169 | - name: shared-app |
| 170 | emptyDir: {} |
| 171 | - name: host-rootfs |
| 172 | hostPath: |
| 173 | path: / |
| 174 | {{- if .Values.config.coreDump.enabled }} |
| 175 | - name: coredump |
| 176 | hostPath: |
| 177 | path: {{ .Values.config.coreDump.path }} |
| 178 | {{- end }} |
| 179 | {{- end }} |