Stop using puppet to configure VIPs in /etc/hosts
authorDan Prince <dprince@redhat.com>
Fri, 25 Nov 2016 16:20:57 +0000 (11:20 -0500)
committerDan Prince <dprince@redhat.com>
Sun, 27 Nov 2016 18:20:33 +0000 (13:20 -0500)
This patch drops use of the vip-hosts.yaml service which can
cause issues during deployment because puppet 'hosts' resources
overwrite the data in /etc/hosts. The only reason things seem to work
at all at the moment is because our hosts element in t-i-e runs
on each os-refresh-config iteration and re-adds the dropped hosts
entries.

To work around the issue we add a conditional which selectively
adds the extra hosts entries only if the AddVipsToEtcHosts is set
to true.

Closes-bug: 1645123

Change-Id: Ic6aaeb249a127df83894f32a704219683a6382b2

environments/hyperconverged-ceph.yaml
environments/use-dns-for-vips.yaml
hosts-config.yaml
overcloud-resource-registry-puppet.j2.yaml
overcloud.j2.yaml
puppet/services/vip-hosts.yaml [deleted file]
roles_data.yaml

index 8258ae9..77fa5a4 100644 (file)
@@ -25,5 +25,4 @@ parameter_defaults:
     - OS::TripleO::Services::OpenDaylightOvs
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts
-    - OS::TripleO::Services::CephOSD
\ No newline at end of file
+    - OS::TripleO::Services::CephOSD
index daf07bc..b700312 100644 (file)
@@ -1,5 +1,5 @@
 # A Heat environment file which can be used to disable the writing of the VIPs
 # to the /etc/hosts file in the overcloud. Use this in case you have a working
 # DNS server that you will provide for the overcloud.
-resource_registry:
-  OS::TripleO::Services::VipHosts: OS::Heat::None
+parameter_defaults:
+  AddVipsToEtcHosts: False
index df0addf..b5a22b7 100644 (file)
@@ -3,7 +3,7 @@ description: 'All Hosts Config'
 
 parameters:
   hosts:
-    type: comma_delimited_list
+    type: string
 
 resources:
 
@@ -12,10 +12,7 @@ resources:
     properties:
       group: os-apply-config
       config:
-        hosts:
-          list_join:
-          - "\n"
-          - {get_param: hosts}
+        hosts: {get_param: hosts}
 
 outputs:
   config_id:
index 19766ad..701c0c6 100644 (file)
@@ -181,7 +181,6 @@ resource_registry:
   OS::TripleO::Services::GnocchiApi: puppet/services/gnocchi-api.yaml
   OS::TripleO::Services::GnocchiMetricd: puppet/services/gnocchi-metricd.yaml
   OS::TripleO::Services::GnocchiStatsd: puppet/services/gnocchi-statsd.yaml
-  OS::TripleO::Services::VipHosts: puppet/services/vip-hosts.yaml
   # Services that are disabled by default (use relevant environment files):
   OS::TripleO::Services::FluentdClient: OS::Heat::None
   OS::TripleO::LoggingConfiguration: puppet/services/logging/fluentd-config.yaml
index f3a7126..ba1c6b3 100644 (file)
@@ -170,9 +170,50 @@ parameters:
     description: >
       Setting this to a unique value will re-run any deployment tasks which
       perform configuration on a Heat stack-update.
+  AddVipsToEtcHosts:
+    default: True
+    type: boolean
+    description: >
+      Set to true to append per network Vips to /etc/hosts on each node.
+
+conditions:
+  add_vips_to_etc_hosts: {equals : [{get_param: AddVipsToEtcHosts}, True]}
 
 resources:
 
+  VipHosts:
+    type: OS::Heat::Value
+    properties:
+      type: string
+      value:
+        list_join:
+        - '\n'
+        - - str_replace:
+              template: IP  HOST
+              params:
+                IP: {get_attr: [VipMap, net_ip_map, external]}
+                HOST: {get_param: CloudName}
+          - str_replace:
+              template: IP  HOST
+              params:
+                IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
+                HOST: {get_param: CloudNameCtlplane}
+          - str_replace:
+              template: IP  HOST
+              params:
+                IP: {get_attr: [VipMap, net_ip_map, internal_api]}
+                HOST: {get_param: CloudNameInternal}
+          - str_replace:
+              template: IP  HOST
+              params:
+                IP: {get_attr: [VipMap, net_ip_map, storage]}
+                HOST: {get_param: CloudNameStorage}
+          - str_replace:
+              template: IP  HOST
+              params:
+                IP: {get_attr: [VipMap, net_ip_map, storage_mgmt]}
+                HOST: {get_param: CloudNameStorageManagement}
+
   HeatAuthEncryptionKey:
     type: OS::Heat::RandomString
 
@@ -328,8 +369,15 @@ resources:
     type: OS::TripleO::Hosts::SoftwareConfig
     properties:
       hosts:
+        list_join:
+        - '\n'
+        - - if:
+            - add_vips_to_etc_hosts
+            - {get_attr: [VipHosts, value]}
+            - ''
+        -
 {% for role in roles %}
-        - list_join:
+          - list_join:
             - '\n'
             - {get_attr: [{{role.name}}, hosts_entry]}
 {% endfor %}
@@ -581,32 +629,7 @@ outputs:
       list_join:
       - "\n"
       - - {get_attr: [hostsConfig, hosts_entries]}
-      -
-        - str_replace:
-            template: IP  HOST
-            params:
-              IP: {get_attr: [VipMap, net_ip_map, external]}
-              HOST: {get_param: CloudName}
-        - str_replace:
-            template: IP  HOST
-            params:
-              IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
-              HOST: {get_param: CloudNameCtlplane}
-        - str_replace:
-            template: IP  HOST
-            params:
-              IP: {get_attr: [VipMap, net_ip_map, internal_api]}
-              HOST: {get_param: CloudNameInternal}
-        - str_replace:
-            template: IP  HOST
-            params:
-              IP: {get_attr: [VipMap, net_ip_map, storage]}
-              HOST: {get_param: CloudNameStorage}
-        - str_replace:
-            template: IP  HOST
-            params:
-              IP: {get_attr: [VipMap, net_ip_map, storage_mgmt]}
-              HOST: {get_param: CloudNameStorageManagement}
+      - - {get_attr: [VipHosts, value]}
   EnabledServices:
     description: The services enabled on each role
     value:
diff --git a/puppet/services/vip-hosts.yaml b/puppet/services/vip-hosts.yaml
deleted file mode 100644 (file)
index a9d757e..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-heat_template_version: 2016-04-08
-
-description: >
-  If the deployer doesn't have a DNS server for the overcloud nodes. This will
-  populate the node-names and IPs for the VIPs of the overcloud.
-
-parameters:
-  ServiceNetMap:
-    default: {}
-    description: Mapping of service_name -> network name. Typically set
-                 via parameter_defaults in the resource registry.  This
-                 mapping overrides those in ServiceNetMapDefaults.
-    type: json
-  DefaultPasswords:
-    default: {}
-    type: json
-  EndpointMap:
-    default: {}
-    description: Mapping of service endpoint -> protocol. Typically set
-                 via parameter_defaults in the resource registry.
-    type: json
-
-outputs:
-  role_data:
-    description: role data for the VIP hosts role
-    value:
-      service_name: vip_hosts
-      config_settings:
-        tripleo::vip_hosts::hosts_spec:
-          external:
-            name: "%{hiera('cloud_name_external')}"
-            ip: "%{hiera('public_virtual_ip')}"
-            ensure: present
-            comment: FQDN of the external VIP
-          internal_api:
-            name: "%{hiera('cloud_name_internal_api')}"
-            ip: "%{hiera('internal_api_virtual_ip')}"
-            ensure: present
-            comment: FQDN of the internal api VIP
-          storage:
-            name: "%{hiera('cloud_name_storage')}"
-            ip: "%{hiera('storage_virtual_ip')}"
-            ensure: present
-            comment: FQDN of the storage VIP
-          storage_mgmt:
-            name: "%{hiera('cloud_name_storage_mgmt')}"
-            ip: "%{hiera('storage_mgmt_virtual_ip')}"
-            ensure: present
-            comment: FQDN of the storage mgmt VIP
-          ctlplane:
-            name: "%{hiera('cloud_name_ctlplane')}"
-            ip: "%{hiera('controller_virtual_ip')}"
-            ensure: present
-            comment: FQDN of the ctlplane VIP
-      step_config: |
-        include ::tripleo::vip_hosts
index 0317e1b..d7ed80c 100644 (file)
@@ -94,7 +94,6 @@
     - OS::TripleO::Services::OpenDaylightOvs
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts
     - OS::TripleO::Services::BarbicanApi
     - OS::TripleO::Services::PankoApi
 
     - OS::TripleO::Services::OpenDaylightOvs
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts
 
 - name: BlockStorage
   ServicesDefault:
     - OS::TripleO::Services::TripleoFirewall
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts
 
 - name: ObjectStorage
   ServicesDefault:
     - OS::TripleO::Services::TripleoFirewall
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts
 
 - name: CephStorage
   ServicesDefault:
     - OS::TripleO::Services::TripleoFirewall
     - OS::TripleO::Services::SensuClient
     - OS::TripleO::Services::FluentdClient
-    - OS::TripleO::Services::VipHosts