Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 1 | # Copyright 2019-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | --- |
| 16 | apiVersion: "k8s.cni.cncf.io/v1" |
| 17 | kind: NetworkAttachmentDefinition |
| 18 | metadata: |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 19 | name: core-net |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 20 | spec: |
| 21 | config: '{ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 22 | "cniVersion": "0.3.1", |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 23 | "type": "simpleovs", |
| 24 | "ipam": { |
| 25 | "type": "static" |
| 26 | } |
| 27 | }' |
| 28 | --- |
| 29 | apiVersion: "k8s.cni.cncf.io/v1" |
| 30 | kind: NetworkAttachmentDefinition |
| 31 | metadata: |
Jeremy Ronquillo | af084f3 | 2020-08-24 13:18:47 -0700 | [diff] [blame] | 32 | name: access-net |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 33 | spec: |
| 34 | config: '{ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 35 | "cniVersion": "0.3.1", |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 36 | "type": "simpleovs", |
| 37 | "ipam": { |
| 38 | "type": "static" |
| 39 | } |
| 40 | }' |
| 41 | --- |
| 42 | apiVersion: "k8s.cni.cncf.io/v1" |
| 43 | kind: NetworkAttachmentDefinition |
| 44 | metadata: |
| 45 | name: enb-net |
| 46 | spec: |
| 47 | config: '{ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 48 | "cniVersion": "0.3.1", |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 49 | "type": "simpleovs", |
| 50 | "ipam": { |
| 51 | "type": "static" |
| 52 | } |
| 53 | }' |
| 54 | --- |
| 55 | apiVersion: v1 |
| 56 | kind: Pod |
| 57 | metadata: |
| 58 | name: router |
| 59 | labels: |
| 60 | app: router |
| 61 | annotations: |
| 62 | k8s.v1.cni.cncf.io/networks: '[ |
Hyunsun | 84f0f17 | 2020-09-23 15:40:08 -0500 | [diff] [blame] | 63 | { "name": "core-net", "interface": "core-rtr", "ips": ["192.168.250.1/24"] }, |
| 64 | { "name": "enb-net", "interface": "enb-rtr", "ips": ["192.168.251.1/24"] }, |
| 65 | { "name": "access-net", "interface": "access-rtr", "ips": ["192.168.252.1/24"] } |
Jeremy Ronquillo | 6be909e | 2020-08-24 09:36:13 -0700 | [diff] [blame] | 66 | ]' |
| 67 | spec: |
| 68 | containers: |
| 69 | - name: quagga |
| 70 | command: ["/bin/bash", "-c"] |
| 71 | args: |
| 72 | - > |
| 73 | sysctl -w net.ipv4.ip_forward=1; |
| 74 | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; |
| 75 | trap : TERM INT; sleep infinity & wait |
| 76 | image: opencord/quagga |
| 77 | securityContext: |
| 78 | privileged: true |
| 79 | capabilities: |
| 80 | add: |
| 81 | - NET_ADMIN |
| 82 | ports: |
| 83 | - containerPort: 2601 |