Skip to content

Commit

Permalink
dind: Ensure unique node config and fix perms
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed Oct 11, 2016
1 parent b06e6e2 commit c9fb01c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions images/dind/master/openshift-generate-master-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function ensure-master-config() {
--master="https://${ip_addr}:8443" \
--network-plugin="${OPENSHIFT_NETWORK_PLUGIN}"

# ensure the configuration is readable outside of the container
find "${config_path}" -exec chmod ga+rw {} \;
find "${config_path}" -type d -exec chmod ga+x {} \;
# ensure the configuration can be used outside of the container
chmod -R ga+rX "${master_path}"
chmod ga+w "${master_path}/admin.kubeconfig"
}

ensure-master-config
14 changes: 9 additions & 5 deletions images/dind/node/openshift-generate-node-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ function ensure-node-config() {
host="${host}-node"
fi
local node_config_path="${config_path}/node-${host}"
local config_file="${node_config_path}/node-config.yaml"
local node_config_file="${node_config_path}/node-config.yaml"

# If the node config has not been generated
if [[ ! -f "${config_file}" ]]; then
if [[ ! -f "${node_config_file}" ]]; then
local master_config_path="${config_path}/master"
local master_config_file="${master_config_path}/admin.kubeconfig"

# Wait for the master to generate its config
local condition="test -f ${master_config_path}/admin.kubeconfig"
local condition="test -f ${master_config_file}"
os::util::wait-for-condition "admin config" "${condition}" "${OS_WAIT_FOREVER}"

local master_host
master_host="$(grep server "${master_config_path}/admin.kubeconfig" | grep -v localhost | awk '{print $2}')"
master_host="$(grep server "${master_config_file}" | grep -v localhost | awk '{print $2}')"

local ip_addr
ip_addr="$(ip addr | grep inet | grep eth0 | awk '{print $2}' | sed -e 's+/.*++')"
Expand All @@ -59,9 +60,12 @@ function ensure-node-config() {
) 200>"${config_path}"/.openshift-generate-node-config.lock
fi

# ensure the configuration is readable outside of the container
chmod -R ga+rX "${node_config_path}"

# Deploy the node config
mkdir -p "${deployed_config_path}"
cp -r "${config_path}"/* "${deployed_config_path}"
cp -r "${node_config_path}"/* "${deployed_config_path}/"
}

ensure-node-config

0 comments on commit c9fb01c

Please sign in to comment.