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: '[ |
| 35 | { "name": "s1u-net", "interface": "s1u-net" }, |
| 36 | { "name": "sgi-net", "interface": "sgi-net" } |
| 37 | ]' |
| 38 | spec: |
| 39 | {{- if not .Values.network.sriov.enabled }} |
| 40 | initContainers: |
| 41 | - name: spgwu-iptables-init |
| 42 | image: {{ .Values.spgwu.images.tags.init | quote }} |
| 43 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 44 | command: [ "sh", "-xec"] |
| 45 | securityContext: |
| 46 | capabilities: |
| 47 | add: |
| 48 | - NET_ADMIN |
| 49 | args: |
| 50 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 51 | - name: spgwu-af-iface-init |
| 52 | image: {{ .Values.spgwu.images.tags.spgwu | quote }} |
| 53 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 54 | securityContext: |
| 55 | capabilities: |
| 56 | add: |
| 57 | - NET_ADMIN |
| 58 | command: |
| 59 | - /opt/dp/scripts/setup-af-iface.sh |
| 60 | volumeMounts: |
| 61 | - name: dp-script |
| 62 | mountPath: /opt/dp/scripts/setup-af-iface.sh |
| 63 | subPath: setup-af-iface.sh |
| 64 | {{- end }} |
| 65 | containers: |
| 66 | - name: {{ .Values.spgwu.name }} |
| 67 | image: {{ .Values.spgwu.images.tags.spgwu | quote }} |
| 68 | imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }} |
| 69 | stdin: true |
| 70 | tty: true |
| 71 | env: |
| 72 | - name: MEM_LIMIT |
| 73 | valueFrom: |
| 74 | resourceFieldRef: |
| 75 | containerName: {{ .Values.spgwu.name }} |
| 76 | resource: limits.memory |
| 77 | divisor: 1Mi |
| 78 | - name: S1U_DEVNAME |
| 79 | {{- if .Values.network.sriov.enabled }} |
| 80 | value: s1u-net |
| 81 | {{- else }} |
| 82 | value: {{ .Values.spgwu.conf.dp.s1u_af_dev | quote }} |
| 83 | {{- end }} |
| 84 | - name: SGI_DEVNAME |
| 85 | {{- if .Values.network.sriov.enabled }} |
| 86 | value: sgi-net |
| 87 | {{- else }} |
| 88 | value: {{ .Values.spgwu.conf.dp.sgi_af_dev | quote }} |
| 89 | {{- end }} |
| 90 | - name: DEVICES |
| 91 | value: {{ .Values.spgwu.conf.dp.devices | quote }} |
| 92 | - name: CP_ADDR |
| 93 | value: spgwc-0.{{ .Values.spgwc.name }} |
| 94 | - name: DP_ADDR |
| 95 | valueFrom: |
| 96 | fieldRef: |
| 97 | fieldPath: status.podIP |
| 98 | - name: RTR_SGI_IP |
| 99 | value: {{ .Values.spgwu.conf.dp.rtr_sgi_ip | quote }} |
| 100 | - name: SGI_MASK |
| 101 | value: {{ .Values.spgwu.conf.dp.sgi_mask | quote }} |
| 102 | command: ["bash", "-xc"] |
| 103 | args: |
| 104 | - ip a; |
| 105 | /opt/dp/scripts/launch.sh; |
| 106 | volumeMounts: |
| 107 | - name: dp-script |
| 108 | mountPath: /opt/dp/scripts/launch.sh |
| 109 | subPath: launch.sh |
| 110 | - name: dp-config |
| 111 | mountPath: /etc/dp/config |
| 112 | #- name: hugepage |
| 113 | # mountPath: /dev/hugepages |
| 114 | resources: |
| 115 | limits: |
| 116 | #hugepages-1Gi: 8Gi |
| 117 | cpu: {{ .Values.spgwu.resources.cpu | quote }} |
| 118 | memory: {{ .Values.spgwu.resources.memory }} |
| 119 | {{- if .Values.network.sriov.enabled }} |
| 120 | intel.com/sriov: 2 |
| 121 | {{- end }} |
| 122 | securityContext: |
| 123 | capabilities: |
| 124 | add: |
| 125 | - IPC_LOCK |
| 126 | volumes: |
| 127 | - name: dp-script |
| 128 | configMap: |
| 129 | name: {{ .Values.spgwu.name }} |
| 130 | defaultMode: 493 |
| 131 | - name: dp-config |
| 132 | configMap: |
| 133 | name: {{ .Values.spgwu.name }} |
| 134 | defaultMode: 420 |
| 135 | #- name: hugepage |
| 136 | # emptyDir: |
| 137 | # medium: HugePages |