]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: Add parameter to set keepalived's virtual router id
authorLuis Domingues <domingues.luis@protonmail.ch>
Tue, 20 Jun 2023 07:07:57 +0000 (09:07 +0200)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:36:16 +0000 (13:36 -0400)
When deploying more than 1 ingress, two instances of keepalived
can be generated with the same virtual_router_id. This commit
adds posibility to change the virtual_router_id of keepalived
from the spec file.

Signed-off-by: Luis Domingues <domingues.luis@protonmail.ch>
(cherry picked from commit bb69368fb5cd1def58cbe638dbd4d3bcf63e431f)
(cherry picked from commit 12cb31447e9a4efe02b32b03271d288a2ebcb0ab)

doc/cephadm/services/rgw.rst
src/pybind/mgr/cephadm/services/ingress.py
src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2
src/python-common/ceph/deployment/service_spec.py

index 740f74bb9b5d808f3e51b1f36ef849d32169b6bc..20ec39a88dd1a8fa84e5d13d9c31ca716017d957 100644 (file)
@@ -272,6 +272,7 @@ It is a yaml format file with the following properties:
       frontend_port: <integer>            # ex: 8080
       monitor_port: <integer>             # ex: 1967, used by haproxy for load balancer status
       virtual_interface_networks: [ ... ] # optional: list of CIDR networks
+      first_virtual_router_id: <integer>  # optional: default 50
       ssl_cert: |                         # optional: SSL certificate and key
         -----BEGIN CERTIFICATE-----
         ...
@@ -315,6 +316,11 @@ where the properties of this service specification are:
     By default, cephadm will configure keepalived to use the same interface where the VIPs are
     for VRRP communication. If another interface is needed, it can be set via ``vrrp_interface_network``
     with a network to identify which ethernet interface to use.
+* ``first_virtual_router_id``
+    Default is 50. When deploying more than 1 ingress, this parameter can be used to ensure each
+    keepalived will have different virtual_router_id. In the case of using ``virtual_ips_list``,
+    each IP will create its own virtual router. So the first one will have ``first_virtual_router_id``,
+    second one will have ``first_virtual_router_id`` + 1, etc. Valid values go from 1 to 255.
 
 .. _ingress-virtual-ip:
 
index be68180ac83c9ce6369c2a3b307fc3f34b3bda88..8803821b497634bde87e56c954ad479669acae88 100644 (file)
@@ -356,6 +356,7 @@ class IngressService(CephService):
                 'interface': interface,
                 'vrrp_interface': vrrp_interface,
                 'virtual_ips': virtual_ips,
+                'first_virtual_router_id': spec.first_virtual_router_id,
                 'states': states,
                 'priorities': priorities,
                 'other_ips': other_ips,
index 006db52ea112ac776017a0dc93fdaf07305d393b..dfab7e342451d0a802b91c42322ba4d8e6bcf967 100644 (file)
@@ -12,7 +12,7 @@ vrrp_instance VI_{{ x }} {
   state {{ states[x] }}
   priority {{ priorities[x] }}
   interface {{ vrrp_interface }}
-  virtual_router_id {{ 50 + x }}
+  virtual_router_id {{ first_virtual_router_id + x }}
   advert_int 1
   authentication {
       auth_type PASS
index ea8a012bba3778f4e68cd7eef347544df0594184..be9f3e8ea584ebb6c2f879db79af6bf551b2f50b 100644 (file)
@@ -1286,6 +1286,7 @@ class IngressSpec(ServiceSpec):
                  virtual_interface_networks: Optional[List[str]] = [],
                  use_keepalived_multicast: Optional[bool] = False,
                  vrrp_interface_network: Optional[str] = None,
+                 first_virtual_router_id: Optional[int] = 50,
                  unmanaged: bool = False,
                  ssl: bool = False,
                  keepalive_only: bool = False,
@@ -1320,6 +1321,7 @@ class IngressSpec(ServiceSpec):
         self.virtual_interface_networks = virtual_interface_networks or []
         self.use_keepalived_multicast = use_keepalived_multicast
         self.vrrp_interface_network = vrrp_interface_network
+        self.first_virtual_router_id = first_virtual_router_id
         self.unmanaged = unmanaged
         self.ssl = ssl
         self.keepalive_only = keepalive_only