Browse Source

Adds auto-detection for VIP interfaces

Previously the ctrl plane VIP would default to 'br-ex' which in non-vlan
deployments ends up being the wrong interface.  The public VIP interface
was also defaulted to 'br-ex' which would be incorrect for vlan based
deployments.  Since a user has already given the nic template (and in
most cases the subnet that corresponds to the nic) the installer should
be able to figure out which interface the public/control vip should be
on.

These changes enable that type of auto-detection, unless a user
explicitly overrides the heat parameters for ControlVirtualInterface and
PublicVirtualInterface.  Also removes calling keepalived from haproxy
now that the services are composed separately on the Controller role.

Partial-Bug: 1606632

Change-Id: I05105fce85be8ace986db351cdca2916f405ed04
Signed-off-by: Tim Rozet <trozet@redhat.com>
tags/6.1.0
Tim Rozet 2 years ago
parent
commit
87763459ae
2 changed files with 44 additions and 15 deletions
  1. 0
    12
      manifests/haproxy.pp
  2. 44
    3
      manifests/profile/base/keepalived.pp

+ 0
- 12
manifests/haproxy.pp View File

@@ -19,10 +19,6 @@
19 19
 #
20 20
 # === Parameters:
21 21
 #
22
-# [*keepalived*]
23
-#  Whether to configure keepalived to manage the VIPs or not.
24
-#  Defaults to hiera('keepalived_enabled')
25
-#
26 22
 # [*haproxy_service_manage*]
27 23
 #  Will be passed as value for service_manage to HAProxy module.
28 24
 #  Defaults to true
@@ -449,7 +445,6 @@
449 445
 class tripleo::haproxy (
450 446
   $controller_virtual_ip,
451 447
   $public_virtual_ip,
452
-  $keepalived                  = hiera('keepalived_enabled', false),
453 448
   $haproxy_service_manage      = true,
454 449
   $haproxy_global_maxconn      = 20480,
455 450
   $haproxy_default_maxconn     = 4096,
@@ -605,13 +600,6 @@ class tripleo::haproxy (
605 600
     $controller_hosts_names_real = downcase(any2array(split($controller_hosts_names, ',')))
606 601
   }
607 602
 
608
-  # This code will be removed once we switch undercloud and overcloud to use both haproxy & keepalived roles.
609
-  if str2bool($keepalived) {
610
-    include ::tripleo::keepalived
611
-    # Make sure keepalive starts before haproxy.
612
-    Class['::keepalived::service'] -> Class['::haproxy']
613
-  }
614
-
615 603
   # TODO(bnemec): When we have support for SSL on private and admin endpoints,
616 604
   # have the haproxy stats endpoint use that certificate by default.
617 605
   if $haproxy_stats_certificate {

+ 44
- 3
manifests/profile/base/keepalived.pp View File

@@ -27,13 +27,54 @@
27 27
 #   for more details.
28 28
 #   Defaults to hiera('step')
29 29
 #
30
+# [*control_virtual_interface*]
31
+#   (Optional) Interface specified for control plane network
32
+#   Defaults to hiera('tripleo::keepalived::control_virtual_interface', false)
33
+#
34
+# [*control_virtual_ip*]
35
+#   Virtual IP address used for control plane network
36
+#   Defaults to hiera('tripleo::keepalived::controller_virtual_ip')
37
+#
38
+# [*public_virtual_interface*]
39
+#   (Optional) Interface specified for public/external network
40
+#   Defaults to hiera('tripleo::keepalived::public_virtual_interface', false)
41
+#
42
+# [*public_virtual_ip*]
43
+#   Virtual IP address used for public/ network
44
+#   Defaults to hiera('tripleo::keepalived::public_virtual_ip')
45
+#
30 46
 class tripleo::profile::base::keepalived (
31
-  $enable_load_balancer = hiera('enable_load_balancer', true),
32
-  $step                 = hiera('step'),
47
+  $enable_load_balancer      = hiera('enable_load_balancer', true),
48
+  $control_virtual_interface = hiera('tripleo::keepalived::control_virtual_interface', false),
49
+  $control_virtual_ip        = hiera('tripleo::keepalived::controller_virtual_ip'),
50
+  $public_virtual_interface  = hiera('tripleo::keepalived::public_virtual_interface', false),
51
+  $public_virtual_ip         = hiera('tripleo::keepalived::public_virtual_ip'),
52
+  $step                      = hiera('step'),
33 53
 ) {
34 54
   if $step >= 1 {
35 55
     if $enable_load_balancer and hiera('enable_keepalived', true){
36
-      include ::tripleo::keepalived
56
+      if ! $control_virtual_interface {
57
+        $control_detected_interface = interface_for_ip($control_virtual_ip)
58
+        if ! $control_detected_interface {
59
+          fail('Unable to find interface for control plane network')
60
+        }
61
+      } else {
62
+        $control_detected_interface = $control_virtual_interface
63
+      }
64
+
65
+      if ! $public_virtual_interface {
66
+        $public_detected_interface = interface_for_ip($public_virtual_ip)
67
+        if ! $public_detected_interface {
68
+          fail('Unable to find interface for public network')
69
+        }
70
+      } else {
71
+        $public_detected_interface = $public_virtual_interface
72
+      }
73
+
74
+      class { '::tripleo::keepalived':
75
+        control_virtual_interface => $control_detected_interface,
76
+        public_virtual_interface  => $public_detected_interface,
77
+      }
37 78
     }
38 79
   }
39 80
 }

Loading…
Cancel
Save