Skip to content

Commit

Permalink
gh-53 Allow to control how to talk to k8s in installer
Browse files Browse the repository at this point in the history
  • Loading branch information
holandes22 committed Mar 5, 2016
1 parent 8f21035 commit 24149a7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
19 changes: 19 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,27 @@ $ sh start-in-k8s
The newly created replication controller might take some time to spin up a new pod. After the pod is up, the application should become
available. See the usage section to get started.

The installer uses the following defaults to talk to kubernetes:

- *Cluster address:* http://localhost:8080
- *kubectl path:* kubectl

You can control the above by setting the envars: `KUBE_ADMIN_CLUSTER_ADDR` and `KUBE_ADMIN_KUBECTL_PATH`

# Upgrade

Untill the install script supports upgrade, use:

kubectl rolling-update kube-admin-<someversion> -f rc-manifest.yml --namespace="kube-system"

# Alternative install options

At this moment, the application has no dedicated back-end and it is formed only of static files (javascript, css, html) therefore
is quite simple to just serve this files. For example, using python simple HTTP server module:

cd dist # dir containing index.html and the compiled static files
python2 -m SimpleHTTPServer

Now the app is served at localhost:8000

To simplify, I just provided the install in kubernetes option, but if there is need for other ways to serve the app, they should be quite easy to add.
19 changes: 16 additions & 3 deletions packaging/kubernetes/start-in-k8s
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#!/usr/bin/bash
set -e

KUBE_CLUSTER=http://localhost:8080
KBIN="kubectl -s $KUBE_CLUSTER"

if [ -z "$KUBE_ADMIN_CLUSTER_ADDR" ]; then
CLUSTER_ADDR=http://localhost:8080
else
CLUSTER_ADDR="$KUBE_ADMIN_CLUSTER_ADDR"
fi

if [ -z "$KUBE_ADMIN_KUBECTL_PATH" ]; then
KUBECTL_PATH=kubectl
else
KUBECTL_PATH="$KUBE_ADMIN_KUBECTL_PATH"
fi

KBIN="$KUBECTL_PATH -s $CLUSTER_ADDR"

echo "Using kubectl: $KBIN"

already_created() {
ret_val=1
if [ $($KBIN get $1 --namespace=kube-system -l k8s-app=kube-admin |awk '{print $1}'|tail -1) = "kube-admin" ];
if [[ $($KBIN get $1 --namespace=kube-system -l k8s-app=kube-admin |awk '{print $1}'|tail -1) == *"kube-admin"* ]];
then
return 0
fi
Expand Down
6 changes: 3 additions & 3 deletions packaging/templates/rc-manifest.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ metadata:
name: kube-admin-{{ version }}
namespace: kube-system
labels:
k8s-app: kube-admin-{{ version }}
k8s-app: kube-admin
version: {{ version }}
kubernetes.io/cluster-service: "true"
spec:
replicas: 1
selector:
k8s-app: kube-admin-{{ version }}
k8s-app: kube-admin
version: {{ version }}
template:
metadata:
labels:
k8s-app: kube-admin-{{ version }}
k8s-app: kube-admin
version: {{ version }}
kubernetes.io/cluster-service: "true"
spec:
Expand Down

0 comments on commit 24149a7

Please # to comment.