Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

k8s/script: allow parallelizing custom script without clear-containers #2067

Merged
merged 1 commit into from
Jan 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions parts/k8s/kubernetesmastercustomscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Master only secrets
# APISERVER_PRIVATE_KEY CA_CERTIFICATE CA_PRIVATE_KEY MASTER_FQDN KUBECONFIG_CERTIFICATE
# KUBECONFIG_KEY ETCD_SERVER_CERTIFICATE ETCD_SERVER_PRIVATE_KEY ETCD_CLIENT_CERTIFICATE ETCD_CLIENT_PRIVATE_KEY
# KUBECONFIG_KEY ETCD_SERVER_CERTIFICATE ETCD_SERVER_PRIVATE_KEY ETCD_CLIENT_CERTIFICATE ETCD_CLIENT_PRIVATE_KEY
# ETCD_PEER_CERTIFICATES ETCD_PEER_PRIVATE_KEYS ADMINUSER MASTER_INDEX

# Find distro name via ID value in releases files and upcase
Expand Down Expand Up @@ -59,7 +59,7 @@ ensureRunCommandCompleted()
echo `date`,`hostname`, startscript>>/opt/m

# A delay to start the kubernetes processes is necessary
# if a reboot is required. Otherwise, the agents will encounter issue:
# if a reboot is required. Otherwise, the agents will encounter issue:
# https://github.com/kubernetes/kubernetes/issues/41185
if [ -f /var/run/reboot-required ]; then
REBOOTREQUIRED=true
Expand Down Expand Up @@ -616,7 +616,7 @@ function writeKubeConfig() {
chown $ADMINUSER:$ADMINUSER $KUBECONFIGFILE
chmod 700 $KUBECONFIGDIR
chmod 600 $KUBECONFIGFILE

# disable logging after secret output
set +x
echo "
Expand Down Expand Up @@ -644,18 +644,23 @@ users:
set -x
}

ensureRunCommandCompleted
echo `date`,`hostname`, RunCmdCompleted>>/opt/m
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]]; then
# If the container runtime is "clear-containers" we need to ensure the
# run command is completed _before_ we start installing all the dependencies
# for clear-containers to make sure there is not a dpkg lock.
ensureRunCommandCompleted
echo `date`,`hostname`, RunCmdCompleted>>/opt/m
fi

if [[ $OS == $UBUNTU_OS_NAME ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this got moved up in your previous PR? if not it can probably go back to right after echo `date`,`hostname`,` RunCmdCompleted>>/opt/m

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it up since we are installing things for clearcontainers i didn't want it to upgrade... but can move inside the if if that hellps

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I think it's needed for all runtimes, not just clearcontainers so let's leave it as is

# make sure walinuxagent doesn't get updated in the middle of running this script
apt-mark hold walinuxagent
fi

# master and node
echo `date`,`hostname`, EnsureDockerStart>>/opt/m
echo `date`,`hostname`, EnsureDockerStart>>/opt/m
ensureDocker
echo `date`,`hostname`, configNetworkPolicyStart>>/opt/m
echo `date`,`hostname`, configNetworkPolicyStart>>/opt/m
configNetworkPolicy
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]]; then
# Ensure we can nest virtualization
Expand All @@ -672,12 +677,17 @@ echo `date`,`hostname`, ensureCRIOStart>>/opt/m
ensureCRIO
echo `date`,`hostname`, ensureKubeletStart>>/opt/m
ensureKubelet
echo `date`,`hostname`, extractKubctlStart>>/opt/m
echo `date`,`hostname`, extractKubctlStart>>/opt/m
extractKubectl
echo `date`,`hostname`, ensureJournalStart>>/opt/m
echo `date`,`hostname`, ensureJournalStart>>/opt/m
ensureJournal
echo `date`,`hostname`, ensureJournalDone>>/opt/m

# On all other runtimes, but "clear-containers" we can ensure the run command
# completed here to allow for parallelizing the custom script
ensureRunCommandCompleted
echo `date`,`hostname`, RunCmdCompleted>>/opt/m

# master only
if [[ ! -z "${APISERVER_PRIVATE_KEY}" ]]; then
writeKubeConfig
Expand Down