Skip to content

Commit

Permalink
Test with latest localkube version
Browse files Browse the repository at this point in the history
Oops! we are using a really old version, let's switch over to v1.7.0
  • Loading branch information
dims committed Jul 7, 2017
1 parent 7fd6d55 commit ebb23b7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
7 changes: 5 additions & 2 deletions kubernetes/client/ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ def __init__(self, configuration, url, headers):
if url.startswith('wss://') and configuration.verify_ssl:
ssl_opts = {
'cert_reqs': ssl.CERT_REQUIRED,
'keyfile': configuration.key_file,
'certfile': configuration.cert_file,
'ca_certs': configuration.ssl_ca_cert or certifi.where(),
}
if configuration.assert_hostname is not None:
ssl_opts['check_hostname'] = configuration.assert_hostname
else:
ssl_opts = {'cert_reqs': ssl.CERT_NONE}

if configuration.cert_file:
ssl_opts['certfile'] = configuration.cert_file
if configuration.key_file:
ssl_opts['keyfile'] = configuration.key_file

self.sock = WebSocket(sslopt=ssl_opts, skip_utf8_validation=False)
self.sock.connect(url, header=header)
self._connected = True
Expand Down
32 changes: 30 additions & 2 deletions scripts/kube-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,47 @@ sudo chmod +x kubectl
sudo mv kubectl /usr/local/bin/

echo "Download localkube from minikube project"
wget -O localkube "https://storage.googleapis.com/minikube/k8sReleases/v1.6.0-alpha.0/localkube-linux-amd64"
wget -O localkube "https://storage.googleapis.com/minikube/k8sReleases/v1.7.0/localkube-linux-amd64"
sudo chmod +x localkube
sudo mv localkube /usr/local/bin/

echo "Starting localkube"
sudo nohup localkube --logtostderr=true --enable-dns=false > localkube.log 2>&1 &

echo "Waiting for localkube to start..."
if ! timeout 120 sh -c "while ! curl -ks https://127.0.0.1:8443/ >/dev/null; do sleep 1; done"; then
if ! timeout 120 sh -c "while ! curl -ks http://127.0.0.1:8080/ >/dev/null; do sleep 1; done"; then
sudo cat localkube.log
die $LINENO "localkube did not start"
fi

echo "Check certificate permissions"
sudo chmod 644 /var/lib/localkube/certs/*
sudo ls -altr /var/lib/localkube/certs/

echo "Set up .kube/config"
mkdir ~/.kube
cat <<EOF > ~/.kube/config
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://localhost:8443
name: local
contexts:
- context:
cluster: local
user: myself
name: local
current-context: local
kind: Config
preferences: {}
users:
- name: myself
user:
client-certificate: /var/lib/localkube/certs/apiserver.crt
client-key: /var/lib/localkube/certs/apiserver.key
EOF

echo "Dump Kubernetes Objects..."
kubectl get componentstatuses
kubectl get configmaps
Expand Down

0 comments on commit ebb23b7

Please sign in to comment.