Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # Copyright 2018 Intel Corporation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | --- |
| 17 | apiVersion: apps/v1 |
| 18 | kind: StatefulSet |
| 19 | metadata: |
| 20 | name: {{ .Values.spgwu.name }} |
| 21 | labels: |
| 22 | app: {{ .Values.spgwu.name }} |
| 23 | spec: |
| 24 | replicas: 1 |
| 25 | selector: |
| 26 | matchLabels: |
| 27 | app: {{ .Values.spgwu.name }} |
| 28 | serviceName: {{ .Values.spgwu.name | quote }} |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
| 32 | app: {{ .Values.spgwu.name }} |
| 33 | annotations: |
| 34 | k8s.v1.cni.cncf.io/networks: '[ |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 35 | { "name": "s1u-net", "interface": "s1u-net", "interfaceRequest": "s1u-net" }, |
| 36 | { "name": "sgi-net", "interface": "sgi-net", "interfaceRequest": "sgi-net" } |
Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 37 | ]' |
| 38 | spec: |
Woojoong Kim | 314d57c | 2019-07-09 17:08:11 -0700 | [diff] [blame] | 39 | {{- if .Values.network.sriov.enabled }} |
| 40 | nodeSelector: |
| 41 | {{ toYaml .Values.spgwu.nodeselector | indent 8 }} |
| 42 | {{- end }} |
Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 43 | {{- if not .Values.network.sriov.enabled }} |
| 44 | initContainers: |
| 45 | - name: spgwu-iptables-init |
| 46 | image: {{ .Values.spgwu.images.tags.init | quote }} |
| 47 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 48 | command: [ "sh", "-xec"] |
| 49 | securityContext: |
| 50 | capabilities: |
| 51 | add: |
| 52 | - NET_ADMIN |
| 53 | args: |
| 54 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 55 | - name: spgwu-af-iface-init |
| 56 | image: {{ .Values.spgwu.images.tags.spgwu | quote }} |
| 57 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 58 | securityContext: |
| 59 | capabilities: |
| 60 | add: |
| 61 | - NET_ADMIN |
| 62 | command: |
| 63 | - /opt/dp/scripts/setup-af-iface.sh |
| 64 | volumeMounts: |
| 65 | - name: dp-script |
| 66 | mountPath: /opt/dp/scripts/setup-af-iface.sh |
| 67 | subPath: setup-af-iface.sh |
| 68 | {{- end }} |
| 69 | containers: |
| 70 | - name: {{ .Values.spgwu.name }} |
| 71 | image: {{ .Values.spgwu.images.tags.spgwu | quote }} |
| 72 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 73 | stdin: true |
| 74 | tty: true |
| 75 | env: |
| 76 | - name: MEM_LIMIT |
| 77 | valueFrom: |
| 78 | resourceFieldRef: |
| 79 | containerName: {{ .Values.spgwu.name }} |
| 80 | resource: limits.memory |
| 81 | divisor: 1Mi |
| 82 | - name: S1U_DEVNAME |
| 83 | {{- if .Values.network.sriov.enabled }} |
| 84 | value: s1u-net |
| 85 | {{- else }} |
| 86 | value: {{ .Values.spgwu.conf.dp.s1u_af_dev | quote }} |
| 87 | {{- end }} |
| 88 | - name: SGI_DEVNAME |
| 89 | {{- if .Values.network.sriov.enabled }} |
| 90 | value: sgi-net |
| 91 | {{- else }} |
| 92 | value: {{ .Values.spgwu.conf.dp.sgi_af_dev | quote }} |
| 93 | {{- end }} |
| 94 | - name: DEVICES |
| 95 | value: {{ .Values.spgwu.conf.dp.devices | quote }} |
| 96 | - name: CP_ADDR |
| 97 | value: spgwc-0.{{ .Values.spgwc.name }} |
| 98 | - name: DP_ADDR |
| 99 | valueFrom: |
| 100 | fieldRef: |
| 101 | fieldPath: status.podIP |
| 102 | - name: RTR_SGI_IP |
| 103 | value: {{ .Values.spgwu.conf.dp.rtr_sgi_ip | quote }} |
| 104 | - name: SGI_MASK |
| 105 | value: {{ .Values.spgwu.conf.dp.sgi_mask | quote }} |
| 106 | command: ["bash", "-xc"] |
| 107 | args: |
| 108 | - ip a; |
| 109 | /opt/dp/scripts/launch.sh; |
| 110 | volumeMounts: |
| 111 | - name: dp-script |
| 112 | mountPath: /opt/dp/scripts/launch.sh |
| 113 | subPath: launch.sh |
| 114 | - name: dp-config |
| 115 | mountPath: /etc/dp/config |
| 116 | #- name: hugepage |
| 117 | # mountPath: /dev/hugepages |
| 118 | resources: |
| 119 | limits: |
| 120 | #hugepages-1Gi: 8Gi |
| 121 | cpu: {{ .Values.spgwu.resources.cpu | quote }} |
| 122 | memory: {{ .Values.spgwu.resources.memory }} |
| 123 | {{- if .Values.network.sriov.enabled }} |
Woojoong Kim | e455aab | 2019-07-12 10:53:43 -0700 | [diff] [blame] | 124 | intel.com/sriov_vfio: 2 |
Hyunsun Moon | a24d3f9 | 2019-06-19 03:04:58 -0500 | [diff] [blame] | 125 | {{- end }} |
| 126 | securityContext: |
| 127 | capabilities: |
| 128 | add: |
| 129 | - IPC_LOCK |
| 130 | volumes: |
| 131 | - name: dp-script |
| 132 | configMap: |
| 133 | name: {{ .Values.spgwu.name }} |
| 134 | defaultMode: 493 |
| 135 | - name: dp-config |
| 136 | configMap: |
| 137 | name: {{ .Values.spgwu.name }} |
| 138 | defaultMode: 420 |
| 139 | #- name: hugepage |
| 140 | # emptyDir: |
| 141 | # medium: HugePages |