]> git.apps.os.sepia.ceph.com Git - ceph.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)
committerLuis Domingues <domingues.luis@protonmail.ch>
Thu, 22 Jun 2023 04:22:09 +0000 (06:22 +0200)
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>
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 664c291c46abffacffef982f7da84725fd2048cc..134c9ce9a39d9364a46118ed271acc6bfa84ca9b 100644 (file)
@@ -352,6 +352,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 232586bead3f14abb83c68afb7488c61dcdd3656..86b3a155246a509e3d96c54b457bf0b114146870 100644 (file)
@@ -1055,6 +1055,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,
@@ -1089,6 +1090,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