This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
/
neutron-l3-agent-daemonset.yml.j2
143 lines (143 loc) · 5.44 KB
/
neutron-l3-agent-daemonset.yml.j2
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
{%- set resourceName = kolla_kubernetes.cli.args.resource_name %}
{%- set loggerConfigmapName = "neutron-l3-agent" %}
{%- set netHostTrue = "yes" %}
{%- import "services/common/common-lib.yml.j2" as lib with context %}
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: neutron-l3-agent-{{ kolla_kubernetes.template.vars.type}}
namespace: {{ kolla_kubernetes_namespace }}
labels:
component: neutron
system: l3-agent-{{ kolla_kubernetes.template.vars.type}}
spec:
template:
metadata:
labels:
component: neutron
system: l3-agent-{{ kolla_kubernetes.template.vars.type}}
annotations:
#FIXME Its unclear if ovsdb_connection, local_ip, and/or hostPID required. Try removing them once we have a working gate to test with.
#FIXME Once out of alpha, this should be converted to yaml.
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "update-config",
"image": "{{ kolla_toolbox_image_full }}",
"command": [
"/bin/sh",
"-c",
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
{%- if enable_openvswitch_tcp == "yes" -%}
TUNNEL_INTERFACE={{ tunnel_interface }};
F=/var/lib/kolla-kubernetes/neutron-openvswitch-agent/tunnel_interface;
[ -f $F ] && TUNNEL_INTERFACE=$(<$F);
IP=$(ip addr list {{ tunnel_interface }} | grep ''inet '' |cut -d'' '' -f6|cut -d/ -f1);
crudini --set /srv/pod-main-config/ml2_conf.ini ovs ovsdb_connection tcp:$IP:6640;
{%- endif -%}
crudini --set /srv/pod-main-config/ml2_conf.ini ovs local_ip $IP;
{%- if kolla_kubernetes.template.vars.type == "compute" -%}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr;
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers false;
{%- else -%}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT handle_internal_only_routers true;
{%- if enable_neutron_dvr == "yes" -%}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode dvr_snat;
{%- else -%}
crudini --set /srv/pod-main-config/l3_agent.ini DEFAULT agent_mode legacy;
{%- endif -%}
{%- endif %}"
],
"volumeMounts": [
{
"name": "neutron-l3-agent-configmap",
"mountPath": "/srv/configmap"
},
{
"name": "pod-main-config",
"mountPath": "/srv/pod-main-config"
}
]
},
{
"name": "update-permissions",
"image": "{{ neutron_l3_agent_image_full }}",
"securityContext": {
"runAsUser": 0
},
"command": [
"/bin/sh",
"-c",
"chown --recursive neutron.kolla /var/log/kolla;
echo FIXME check for ip6tables loaded;"
],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
]'
spec:
hostNetwork: True
hostIPC: True
hostPID: True
nodeSelector:
{%- if kolla_kubernetes.template.vars.type == "compute" %}
{%- set selector = kolla_kubernetes_hostlabel_neutron_l3_agent_compute |
default(kolla_kubernetes_hostlabel_compute) %}
{%- else %}
{%- set selector = global['kolla_kubernetes_hostlabel_neutron_l3_agent_network_' ~ kolla_kubernetes.template.vars.type] |
default(kolla_kubernetes_hostlabel_network |
default(kolla_kubernetes_hostlabel_controller)
)
%}
{%- endif %}
{{ selector.key }}: {{ selector.value }}
containers:
- image: "{{ neutron_l3_agent_image_full }}"
name: main
securityContext:
privileged: true
volumeMounts:
{{ lib.common_volume_mounts(indent=12) }}
- mountPath: {{ container_config_directory }}
name: pod-main-config
- mountPath: /var/lib/neutron/kolla/
name: neutron-metadata-socket
- mountPath: /var/run
name: host-run
- mountPath: /run/netns/
name: host-run-netns
# shared: true # This seems not support in K8s yet :(
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
{{ lib.common_containers(indent=8) }}
volumes:
{{ lib.common_volumes(indent=8) }}
- name: pod-main-config
emptyDir: {}
- name: neutron-l3-agent-configmap
configMap:
name: neutron-l3-agent
items:
- key: neutron.conf
path: neutron.conf
- key: config.json
path: config.json
- key: ml2-conf.ini
path: ml2_conf.ini
- key: fwaas-driver.ini
path: fwaas_driver.ini
- key: l3-agent.ini
path: l3_agent.ini
- name: host-run-netns
hostPath:
path: /run/netns
- name: host-run
hostPath:
path: /var/run
- name: neutron-metadata-socket
hostPath:
path: /var/lib/neutron/kolla/metadata_proxy