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 5efe73a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions images/dind/node/openshift-generate-node-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ function ensure-node-config() {
local ip_addr
ip_addr="$(ip addr | grep inet | grep eth0 | awk '{print $2}' | sed -e 's+/.*++')"

# 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.
exec 200>"${config_path}"/.openshift-generate-node-config.exclusivelock
flock 200

/usr/local/bin/openshift admin create-node-config \
--node-dir="${config_path}" \
--node="${host}" \
Expand All @@ -51,6 +58,9 @@ function ensure-node-config() {
--signer-cert="${master_config_path}/ca.crt" \
--signer-key="${master_config_path}/ca.key" \
--signer-serial="${master_config_path}/ca.serial.txt"

# Release the lock
flock -o
fi

# Deploy the node config
Expand Down

0 comments on commit 5efe73a

Please sign in to comment.