Browse code

Prevent dev cluster deploy from using stale config

When a dev cluster is deployed with vagrant, the nodes wait for their
configuration to be created. If stale configuration is already present,
they may use that configuration before the master has a chance to
generate new configuration. This change marks existing configuration as
stale at the beginning of provisioning to avoid that possiblity.

Maru Newby authored on 2015/10/30 02:10:10
Showing 2 changed files
... ...
@@ -127,6 +127,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
127 127
     # Start an OpenShift cluster
128 128
     # Currently this only works with the (default) VirtualBox provider.
129 129
 
130
+    # Tag configuration as stale when provisioning a dev cluster to
131
+    # ensure that nodes can wait for fresh configuration to be generated.
132
+    if ARGV[0] =~ /^up|provision$/i and not ARGV.include?("--no-provision")
133
+      system('test -d ./openshift.local.config && touch ./openshift.local.config/.stale')
134
+    end
135
+
130 136
     instance_prefix = "openshift"
131 137
 
132 138
     # The number of minions to provision.
... ...
@@ -109,6 +109,10 @@ os::provision::init-certs() {
109 109
   done
110 110
 
111 111
   popd > /dev/null
112
+
113
+  # Indicate to nodes that it's safe to begin provisioning by removing
114
+  # the stale marker.
115
+  rm -f ${config_root}/openshift.local.config/.stale
112 116
 }
113 117
 
114 118
 os::provision::set-os-env() {
... ...
@@ -353,7 +357,8 @@ os::provision::wait-for-node-config() {
353 353
   local msg="node configuration file"
354 354
   local config_file=$(os::provision::get-node-config "${config_root}" \
355 355
     "${node_name}")
356
-  local condition="test -f ${config_file}"
356
+  local condition="test ! -f ${config_root}/openshift.local.config/.stale -a \
357
+-f ${config_file}"
357 358
   os::provision::wait-for-condition "${msg}" "${condition}" \
358 359
     "${OS_WAIT_FOREVER}"
359 360
 }