Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Commit a2c1dc6

Browse files
authored
Merge pull request #13 from mvinkler/minishiftless_okd
Add install-on-okd.sh script
2 parents 3addb8d + 480d941 commit a2c1dc6

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

etc/scripts/install-on-okd.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
function enable_admission_webhooks {
4+
5+
API_SERVER=$(oc config view --minify | grep server | awk -F'//' '{print $2}' | awk -F':' '{print $1}')
6+
KUBE_SSH_USER="cloud-user"
7+
8+
echo "API_SERVER=$API_SERVER"
9+
echo "KUBE_SSH_USER=$KUBE_SSH_USER"
10+
echo "KUBE_SSH_KEY=$KUBE_SSH_KEY"
11+
12+
ssh $KUBE_SSH_USER@$API_SERVER -i $KUBE_SSH_KEY /bin/bash << "EOF"
13+
sudo su - root
14+
cp -n /etc/origin/master/master-config.yaml /etc/origin/master/master-config.yaml.backup
15+
cp -p /etc/origin/master/master-config.yaml /etc/origin/master/master-config.yaml.prepatch
16+
cat > /etc/origin/master/master-config.patch << EOT
17+
admissionConfig:
18+
pluginConfig:
19+
MutatingAdmissionWebhook:
20+
configuration:
21+
apiVersion: apiserver.config.k8s.io/v1alpha1
22+
kubeConfigFile: /dev/null
23+
kind: WebhookAdmission
24+
ValidatingAdmissionWebhook:
25+
configuration:
26+
apiVersion: apiserver.config.k8s.io/v1alpha1
27+
kubeConfigFile: /dev/null
28+
kind: WebhookAdmission
29+
EOT
30+
31+
oc ex config patch /etc/origin/master/master-config.yaml.prepatch -p "$(cat /etc/origin/master/master-config.patch)" > /etc/origin/master/master-config.yaml
32+
/usr/local/bin/master-restart api && /usr/local/bin/master-restart controllers
33+
34+
rm /etc/origin/master/master-config.yaml.prepatch /etc/origin/master/master-config.patch
35+
36+
EOF
37+
38+
# wait until the kube-apiserver is restarted
39+
until oc login -u system:admin 2>/dev/null; do sleep 5; done;
40+
}
41+
42+
if [ -z "$KUBE_SSH_KEY" ]
43+
then
44+
echo " In order for admission webhooks to be enabled, you need to set \$KUBE_SSH_KEY variable,"
45+
echo " pointing to private SSH key for the cloud-user account."
46+
echo " \$KUBE_SSH_KEY is empty - aborting."
47+
exit 1
48+
fi
49+
50+
set -x
51+
52+
enable_admission_webhooks
53+
54+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
55+
"$DIR/install.sh" -q

0 commit comments

Comments
 (0)