Adding possibility to switch off hardcoded compute_node_address
parameter or override it.
If customer uses tenant network for compute nodes communication to
controlplane in OC 3.2, compute_node_address may break configuration
of a vrouter and prevent vrouter from start when switching vrouter
from discovery method to static.
Prod-Related: PROD-35730
Change-Id: I1d611b0b014e3fc671477f8131fd7e2990dbb432
diff --git a/README.rst b/README.rst
index f76e64f..fa39dc7 100644
--- a/README.rst
+++ b/README.rst
@@ -889,6 +889,27 @@
cassandra_gc_logging: false
...
+[vRouter conf] compute.node_address
+-----------------------------------
+
+Specify an ip address to override compute_node_address value in vrouter config
+or set to false to unset it.
+Valid only for OpenContrail vRouter 3.2
+
+.. code-block:: yaml
+
+ opencontrail:
+ compute:
+ node_address:
+ value: 192.168.111.5
+
+ .. code-block:: yaml
+
+ opencontrail:
+ compute:
+ node_address:
+ enabled: false
+
Disable Contrail API authentication
-----------------------------------
diff --git a/opencontrail/files/3.0/contrail-vrouter-agent.conf b/opencontrail/files/3.0/contrail-vrouter-agent.conf
index 4e5a422..335dc74 100644
--- a/opencontrail/files/3.0/contrail-vrouter-agent.conf
+++ b/opencontrail/files/3.0/contrail-vrouter-agent.conf
@@ -226,9 +226,16 @@
# of the compute_node_address to run services that need IP Address in host-os
# (like metadata...)
{%- if compute.bind is defined %}
-compute_node_address={{ compute.bind.address }}
+{%- set compute_node_address = compute.bind.address %}
{%- else %}
-compute_node_address={{ compute.interface.address }}
+{%- set compute_node_address = compute.interface.address %}
+{%- endif %}
+{%- if compute.node_address is defined %}
+{%- if compute.node_address.get('enabled', True) %}
+compute_node_address={{ compute.node_address.get('value', compute_node_address) }}
+{%- endif %}
+{%- else %}
+compute_node_address={{ compute_node_address }}
{%- endif %}
# We can have multiple gateway sections with different indices in the
diff --git a/tests/pillar/vrouter.sls b/tests/pillar/vrouter.sls
index 9458fcf..abfacb1 100644
--- a/tests/pillar/vrouter.sls
+++ b/tests/pillar/vrouter.sls
@@ -24,6 +24,8 @@
compute:
version: 4.1
enabled: True
+ node_address:
+ enabled: false
collector:
members:
- host: 127.0.0.1
@@ -74,4 +76,4 @@
enabled: True
cert_file: /etc/contrail/server.pem
key_file: /etc/contrail/privkey.pem
- ca_cert_file: /etc/contrail/ca-cert.pem
\ No newline at end of file
+ ca_cert_file: /etc/contrail/ca-cert.pem