Skip to content

Commit

Permalink
dind: ensure node certs are generated serially
Browse files Browse the repository at this point in the history
The cert gen commands are not intended to be run concurrently.
  • Loading branch information
marun committed Oct 11, 2016
1 parent 606716e commit b06e6e2
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions images/dind/node/openshift-generate-node-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,23 @@ function ensure-node-config() {
local ip_addr
ip_addr="$(ip addr | grep inet | grep eth0 | awk '{print $2}' | sed -e 's+/.*++')"

/usr/local/bin/openshift admin create-node-config \
--node-dir="${config_path}" \
--node="${host}" \
--master="${master_host}" \
--hostnames="${host},${ip_addr}" \
--network-plugin="${OPENSHIFT_NETWORK_PLUGIN}" \
--node-client-certificate-authority="${master_config_path}/ca.crt" \
--certificate-authority="${master_config_path}/ca.crt" \
--signer-cert="${master_config_path}/ca.crt" \
--signer-key="${master_config_path}/ca.key" \
--signer-serial="${master_config_path}/ca.serial.txt"
# Hold a lock on the shared volume to ensure cert generation is
# performed serially. Cert generation is not compatible with
# concurrent execution since the file passed to --signer-serial
# needs to be incremented by each invocation.
(flock 200;
/usr/local/bin/openshift admin create-node-config \
--node-dir="${node_config_path}" \
--node="${host}" \
--master="${master_host}" \
--hostnames="${host},${ip_addr}" \
--network-plugin="${OPENSHIFT_NETWORK_PLUGIN}" \
--node-client-certificate-authority="${master_config_path}/ca.crt" \
--certificate-authority="${master_config_path}/ca.crt" \
--signer-cert="${master_config_path}/ca.crt" \
--signer-key="${master_config_path}/ca.key" \
--signer-serial="${master_config_path}/ca.serial.txt"
) 200>"${config_path}"/.openshift-generate-node-config.lock
fi

# Deploy the node config
Expand Down

0 comments on commit b06e6e2

Please sign in to comment.