badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2019-present Open Networking Foundation |
| 3 | |
| 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 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 }} |
| 76 | failureThreshold: 30 |
| 77 | periodSeconds: 10 |
| 78 | {{- end }} |
| 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 |
| 90 | {{- if .Values.config.managedByConfigPod.enabled }} |
| 91 | - name: MANAGED_BY_CONFIG_POD |
| 92 | value: "true" |
| 93 | {{- end }} |
| 94 | {{- if .Values.config.spgwc.managedByRoc.enabled }} |
| 95 | - name: DISABLE_CONFIG_WATCHER # If the variable has a value then changes |
| 96 | value: "true" # to subscriber_mapping.json are ignored |
| 97 | {{- end }} |
| 98 | {{- if .Values.resources.enabled }} |
| 99 | resources: |
| 100 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 101 | {{- end }} |
| 102 | volumeMounts: |
| 103 | - name: scripts |
| 104 | mountPath: /opt/cp/scripts |
| 105 | - name: configs |
| 106 | mountPath: /etc/cp/config |
| 107 | - name: shared-app |
| 108 | mountPath: /tmp |
| 109 | {{- if .Values.config.coreDump.enabled }} |
| 110 | - name: coredump |
| 111 | mountPath: /tmp/coredump |
| 112 | {{- end }} |
| 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 |
| 126 | {{- if .Values.resources.enabled }} |
| 127 | resources: |
| 128 | {{ toYaml .Values.resources.spgwc | indent 10 }} |
| 129 | {{- end }} |
| 130 | volumeMounts: |
| 131 | - name: scripts |
| 132 | mountPath: /opt/cp/scripts |
| 133 | - name: configs |
| 134 | mountPath: /etc/cp/config |
| 135 | - name: shared-app |
| 136 | mountPath: /tmp |
| 137 | {{- if .Values.config.coreDump.enabled }} |
| 138 | - name: coredump |
| 139 | mountPath: /tmp/coredump |
| 140 | {{- end }} |
| 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 }} |
| 159 | volumes: |
| 160 | - name: scripts |
| 161 | configMap: |
| 162 | name: spgwc-scripts |
| 163 | defaultMode: 493 |
| 164 | - name: configs |
| 165 | configMap: |
| 166 | name: spgwc-configs |
| 167 | defaultMode: 420 |
| 168 | - name: shared-app |
| 169 | emptyDir: {} |
| 170 | - name: host-rootfs |
| 171 | hostPath: |
| 172 | path: / |
| 173 | {{- if .Values.config.coreDump.enabled }} |
| 174 | - name: coredump |
| 175 | hostPath: |
| 176 | path: {{ .Values.config.coreDump.path }} |
| 177 | {{- end }} |
| 178 | {{- end }} |