aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/kubernetes/roles/sriov/templates/cni-sriov.yml.j2
blob: 3a9e819b513bf6aff42356b089d29ce340ac901d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Copyright (C) 2018, ARM Limited and contributors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: network.kubernetes.com
spec:
  group: kubernetes.com
  version: v1
  scope: Namespaced
  names:
    plural: networks
    singular: network
    kind: Network
    shortNames:
    - net
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flannel
  namespace: {{system_namespace}}
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: {{system_namespace}}
  labels:
    tier: node
    app: flannel
data:
  cni-conf.json: |
    {
      "name": "cbr0",
      "type": "flannel",
      "delegate": {
        "isDefaultGateway": true
      }
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "udp"
      }
    }
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel-ds
  namespace: {{system_namespace}}
  labels:
    tier: node
    app: flannel
spec:
  template:
    metadata:
      labels:
        tier: node
        app: flannel
    spec:
      hostNetwork: true
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      containers:
      - name: kube-flannel
        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}
        imagePullPolicy: {{ k8s_image_pull_policy }}
        command: [ "/opt/bin/flanneld", "--ip-masq", "--kube-subnet-mgr" ]
        securityContext:
          privileged: true
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: run
          mountPath: /run
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      volumes:
        - name: run
          hostPath:
            path: /run
        - name: flannel-cfg
          configMap:
            name: kube-flannel-cfg
---
apiVersion: "kubernetes.com/v1"
kind: Network
metadata:
  name: flannel-conf
  namespace: default
plugin: flannel
args: '[
  {
    "masterplugin": true,
    "delegate": {
      "isDefaultGateway": true
    }
  }
]'
---
apiVersion: "kubernetes.com/v1"
kind: Network
metadata:
  name: sriov-conf1
  namespace: default
plugin: sriov
args: '[
  {
    "master": "eth1.101",
    "pfOnly": true,
    "ipam": {
      "type": "host-local",
      "subnet": "192.168.123.0/24",
      "rangeStart": "192.168.123.11",
      "rangeEnd": "192.168.123.21",
      "routes": [
        {
          "dst": "0.0.0.0/0"
        }
      ],
      "gateway": "192.168.123.1"
    }
  }
]'
---
apiVersion: "kubernetes.com/v1"
kind: Network
metadata:
  name: sriov-conf2
  namespace: default
plugin: sriov
args: '[
  {
    "master": "eth1.101",
    "pfOnly": true,
    "ipam": {
      "type": "host-local",
      "subnet": "192.168.123.0/24",
      "rangeStart": "192.168.123.31",
      "rangeEnd": "192.168.123.41",
      "routes": [
        {
          "dst": "0.0.0.0/0"
        }
      ],
      "gateway": "192.168.123.1"
    }
  }
]'