-
Notifications
You must be signed in to change notification settings - Fork 551
/
Dockerfile.j2
163 lines (134 loc) · 4.97 KB
/
Dockerfile.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block neutron_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='neutron') }}
{% if base_distro in ['debian', 'ubuntu'] %}
{{ macros.debian_haproxy_existing_user_fix() }}
{% endif %}
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set neutron_base_packages = [
'keepalived',
'net-tools',
'radvd',
'openstack-neutron',
'openstack-neutron-fwaas',
'openstack-neutron-lbaas',
'openstack-neutron-ml2',
'openvswitch',
'python-networking-sfc',
'python-networking-vmware-nsx',
'python2-networking-baremetal',
'python2-openvswitch',
'python2-oslo-vmware'
] %}
{% elif base_distro in ['debian'] %}
{% set neutron_base_packages = [
'iproute2',
'iputils-ping',
'keepalived',
'net-tools',
'radvd',
'neutron-plugin-ml2',
'neutron-server',
'openvswitch-switch',
'python-networking-sfc',
'python-networking-vmware-nsx',
'python-openvswitch',
'python-oslo.vmware'
] %}
{% elif base_distro in ['ubuntu'] %}
# FIXED(jeffrey4l): UCA rocky release is not include python-vmware-nsx
# 13.0.0 package now. add 'python-vmware-nsx' into
# neutron_base_packages list after UCA fixed the issue.
{% set neutron_base_packages = [
'iproute2',
'iputils-ping',
'keepalived',
'net-tools',
'radvd',
'neutron-lbaas-common',
'neutron-plugin-ml2',
'neutron-server',
'openvswitch-switch',
'python-networking-sfc',
'python-neutron-fwaas',
'python-openvswitch',
'python-oslo.vmware'
] %}
{% endif %}
{{ macros.install_packages(neutron_base_packages | customizable("packages")) }}
{% if base_distro in ['debian', 'ubuntu'] %}
RUN mkdir -p /usr/share/neutron \
&& ln -s /etc/neutron/api-paste.ini /usr/share/neutron/api-paste.ini
{% endif %}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set neutron_base_packages = [
'conntrack-tools',
'dnsmasq',
'dnsmasq-utils',
'haproxy',
'ipset',
'keepalived',
'net-tools',
'openvswitch',
'python2-openvswitch',
'radvd',
'uuid'
] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set neutron_base_packages = [
'conntrack',
'dnsmasq',
'dnsmasq-utils',
'haproxy',
'iproute2',
'ipset',
'iptables',
'iputils-arping',
'iputils-ping',
'keepalived',
'net-tools',
'openvswitch-switch',
'python-openvswitch',
'radvd',
'uuid-runtime'
] %}
{% endif %}
{{ macros.install_packages(neutron_base_packages | customizable("packages")) }}
ADD neutron-base-archive /neutron-base-source
ADD plugins-archive /
{% set neutron_base_pip_packages = [
'/neutron',
'oslo-vmware'
] %}
{% set neutron_base_plugins_pip_packages = [
'/plugins/*'
] %}
RUN ln -s neutron-base-source/* neutron \
&& {{ macros.install_pip(neutron_base_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/neutron /usr/share/neutron \
&& cp -r /neutron/etc/* /etc/neutron/ \
&& cp -r /neutron/etc/neutron/* /etc/neutron/ \
&& cp /neutron/etc/api-paste.ini /usr/share/neutron \
&& mv /etc/neutron/neutron/ /etc/neutron/plugins/ \
&& chown -R neutron: /etc/neutron /usr/share/neutron \
&& sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/neutron/rootwrap.conf \
&& if [ "$(ls /plugins)" ]; then \
{{ macros.install_pip(neutron_base_plugins_pip_packages) }} \
&& for neutron_plugins in $(ls /plugins); do \
if [ -d "/plugins/$neutron_plugins/etc/neutron/rootwrap.d" ]; then \
cp /plugins/$neutron_plugins/etc/neutron/rootwrap.d/* /etc/neutron/rootwrap.d; \
fi; \
done; \
fi
{% endif %}
COPY neutron_sudoers /etc/sudoers.d/kolla_neutron_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/kolla_neutron_sudoers \
&& touch /usr/local/bin/kolla_neutron_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_neutron_extend_start
{% block neutron_base_footer %}{% endblock %}