puppet-tripleo/manifests
Michele Baldessari 9fdb07ec66 Enforce proper ordering when applying firewall rules
The tripleo firewall module has fundamentally three pieces:
1) firewall::pre (allows existing connections/ssh/icmp)
2) firewall::rule (allows services traffic)
3) firewall::post (drops all traffic)

One of the assumptions coded in the module is the following line:
Service<||> -> Class['tripleo::firewall::post']

Which has been added so that (see also bug LP#1643575):
"""
use ordering to make sure we start all Services in catalog before post
rules. It ensure that we don't drop all traffic before starting the
services, which could lead to services errors (e.g. trying to reach database or amqp)
"""

The problem is that there is nothing specifying that the firewall rules
created by tripleo services need to be implemented between the pre and
post classes. So the following can happen:
Jul 10 05:04:13 overcloud-controller-1 systemd: Started OpenSSH server daemon.
Jul 10 05:04:13 overcloud-controller-1 puppet-user[32418]: (/Stage[main]/Ssh::Server::Service/Service[sshd]) Triggered 'refresh' from 2 events
Jul 10 05:04:13 overcloud-controller-1 puppet-user[32418]: (/Stage[main]/Tripleo::Firewall::Pre/Tripleo::Firewall::Rule[000 accept related established rules]/Firewall[000 accept related established rules ipv4]/ensure) created
...
Jul 10 05:04:13 overcloud-controller-1 puppet-user[32418]: (/Stage[main]/Tripleo::Firewall::Post/Tripleo::Firewall::Rule[998 log all]/Firewall[998 log all ipv4]/ensure) created
...
Jul 10 05:04:14 overcloud-controller-1 puppet-user[32418]: (/Stage[main]/Tripleo::Firewall/Tripleo::Firewall::Service_rules[cinder_api]/Tripleo::Firewall::Rule[119 cinder]/Firewall[119 cinder ipv4]/ensure) created

This means that we can actually open the traffic for our services *after*
said traffic has been completely blocked. In order to fix this we
tag the pre/post rules with a different tag and add resource collectors
to actually enforce proper ordering. We now get:
...
Jul 11 08:54:43 overcloud-controller-0 puppet-user[32554]: (/Stage[main]/Tripleo::Firewall::Pre/Tripleo::Firewall::Rule[000 accept related established rules]/Firewall[000 accept related established rules ipv4]/ensure) created
...
Jul 11 08:54:43 overcloud-controller-0 puppet-user[32554]: (/Stage[main]/Tripleo::Firewall/Tripleo::Firewall::Service_rules[cinder_api]/Tripleo::Firewall::Rule[119 cinder]/Firewall[119 cinder ipv4]/ensure) created
...
Jul 11 08:54:52 overcloud-controller-0 puppet-user[32554]: (/Stage[main]/Tripleo::Firewall::Post/Tripleo::Firewall::Rule[998 log all]/Firewall[998 log all ipv4]/ensure) created

Tested this by doing 20 deploys of 1ctrl+1cmp and then scaling up the
overcloud to 3ctrl+2cmp.

The reason this change, besides being semantically correct, is needed
for scaling up the controller role is the following:
1) When we detect a scaleup situation, we call 'pcs cluster node add <newnode>'
   from the bootstrap node

2) It can happen that 1) succeeds because the node still had no iptables
   at all, so pcs communication succeeds. So at this point the cluster
   has added a new node and all is well

3) Now we apply the pre and post rules and all traffic is blocked. And
   slowly we start adding rules to let services be accessible over the
   network.

4) pacemaker is unable to talk to other nodes and assumes a network split.
   Eventually it will start fencing node to guarantee the state of the
   remote nodes and so the deploy will fail.

With this change if the 'pcs cluster node add' call succeeds we are
guaranteed to not interrupt network traffic afterwards.

NB: cherry-pick had a slight conflict due Ic9a2626e73d132c3be7ff14a1f4cdba0c16c5b53

Change-Id: I01e681a6305e2708bf364781a2032265b146d065
Closes-Bug: #1781147
(cherry picked from commit c525c64f6a)
2018-07-16 14:30:27 +02:00
..
certmonger Removes neutron ownership of certs 2018-04-04 01:54:21 +00:00
cluster Modify cassandra dependency 2015-12-14 14:15:15 +00:00
firewall Enforce proper ordering when applying firewall rules 2018-07-16 14:30:27 +02:00
glance Fix lint issues to upgrade to puppet-lint 2.3 2017-07-21 11:42:45 +02:00
haproxy Add mechanism for cookie-based sessions in endpoints. 2018-07-02 19:40:18 +00:00
host Add support for switchdev mode in SR-IOV 2017-12-12 14:58:43 +00:00
network Implements: Heat template for integrating Cavium SmartNIC LiquidIO 2017-12-12 20:31:16 +05:30
pacemaker Add resource-stickiness=INFINITY to VIPs 2018-04-13 19:07:28 +00:00
packages packages: run upgrade at 'setup' stage 2016-10-14 18:17:30 -04:00
profile Avoid hard-coded settings in Manila HA containers 2018-07-13 12:41:07 +00:00
stunnel Force stunnel to use TLSv1.2 2018-04-20 07:27:04 +00:00
fencing.pp Do not fail fencing configuration when instanceha is disabled 2018-02-06 11:44:12 +01:00
firewall.pp Enforce proper ordering when applying firewall rules 2018-07-16 14:30:27 +02:00
haproxy.pp Add mechanism for cookie-based sessions in endpoints. 2018-07-02 19:40:18 +00:00
init.pp Implement firewalling in tripleo::firewall 2015-07-15 11:58:46 +02:00
keepalived.pp Add custom_vrrp_script param to keepalived 2018-01-20 20:36:52 -05:00
noop.pp Add class to set noop on various puppet resources 2015-07-03 17:16:07 -04:00
packages.pp Ensure package updates don't happen unexpectedly 2016-12-22 16:42:12 +00:00
redis_notification.pp Loadbalancer: Add support for Redis 2015-04-16 21:13:40 +02:00
selinux.pp Add tripleo::selinux 2016-05-05 13:19:20 -04:00
stunnel.pp Lower the default stunnel log level 2018-05-30 11:24:53 +02:00
tls_proxy.pp Set ProxyPreserveHost in ec2api TLS proxy 2017-11-23 10:49:00 +00:00
trusted_ca.pp Add manifests to inject and trust CA certificates 2016-08-23 14:36:20 +00:00
trusted_cas.pp Add manifests to inject and trust CA certificates 2016-08-23 14:36:20 +00:00
ui.pp Add configuration for the Nova proxy endpoint 2018-03-26 08:03:46 +00:00