Repository navigation
Service installation for Kubernetes - #11338
Conversation
szkl
left a comment
There was a problem hiding this comment.
I think it's best to create a new file which sets related environment variables for a service. k8s command would source that file. It is possible to have connectivity checks that way.
| if [ "$param" == "start" ]; then | ||
| command -v VirtualBox >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; } | ||
| command -v minikube >/dev/null 2>&1 || { echo >&2 "I require a Kubernetes cluster. To install minikube: \ | ||
| (curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.20.0/minikube-darwin-amd64 && chmod +x minikube && mv minikube /usr/local/bin/)"; exit 1;} |
There was a problem hiding this comment.
if the naming scheme is consistent in download links, you could infer the the os and replace linux/darwin with that in URLs
| minikube start | ||
|
|
||
| if [[ `uname` == 'Darwin' ]]; then | ||
| command -v helm >/dev/null 2>&1 || { echo >&2 "I require kubernetes-helm but it's not installed. (brew install kubernetes-helm maybe?)"; exit 1; } |
There was a problem hiding this comment.
you can advise this https://github.com/kubernetes/helm/blob/master/docs/install.md#from-script
7dbffee to
7a74309
Compare
|
ready for another review, updated the PR description. |
77099d7 to
a799a46
Compare
| export MINIKUBE_IP=$(minikube ip) | ||
| eval $(minikube docker-env) | ||
|
|
||
| docker image inspect baseinstall:v1 >/dev/null 2>&1 && echo yes || echo no >/tmp/response.log 2>&1 |
There was a problem hiding this comment.
you dont need to write to a file to get the response, you could have it in the exported value
➜ cat test.sh
#!/bin/bash
function fail() { return 1; }
function succ() { return 0; }
succ && echo "succeeded"
fail || echo "failed"
# set the default behaviour
export RESULT="no";
succ && RESULT="yes"
echo $RESULT
fail || RESULT="no"
echo $RESULT
➜ ./test.sh
succeeded
failed
yes
no
|
|
||
| if [[ "$IMAGE_RESPONSE" == "no" ]]; then | ||
| echo 'base installation docker image for koding was not found, building the image:\n' | ||
| docker build -t baseinstall:v1 -f Dockerfile-k8s-base . |
There was a problem hiding this comment.
lets not build the image in user machines, that might create security issues where we can add sensitive information that the codebase has.
There was a problem hiding this comment.
Base images should be generally available already and also must not contain any installation-specific files.
| docker build -t baseinstall:v1 -f Dockerfile-k8s-base . | ||
| fi | ||
|
|
||
| minikube ssh "docker pull mongo:3.2.8" |
There was a problem hiding this comment.
these operations should not be required, kubernetes handles the image pull ops
|
|
||
| kubectl create -f $KONFIG_PROJECTROOT/deployment/kubernetes/backend/backend-deployment.yaml | ||
|
|
||
| export BACKEND_POD_NAME=$(kubectl get pods --namespace default -l "app=backend" -o jsonpath="{.items[0].metadata.name}") |
There was a problem hiding this comment.
- better to use a specific namespace instead of the default one
- app=backend is not a good selector where many other test apps can have "backend" in the default namespace - not an issue once we switch to a dev namespace
There was a problem hiding this comment.
made changes to all reviews accordingly; created a namespace named service-dev (replacing default namespace) and renamed app label to service-installations.
aa5ea88 to
6bf6c85
Compare
afc9c4f to
418d290
Compare
565f0b7 to
91ee97a
Compare
|
|
6b10f13 to
184721c
Compare
|
🎉 |
Initial version of the installation process for Kubernetes.
Description
I added two new commands to the auto-generated ./run script:
./run k8s startand./run k8s stop. Start runs to check whether the dependencies have been previously installed or not. If they have, workers pod is created according to the pod definition in containers.yaml.templateStop command stops the running Kubernetes cluster (minikube)
Motivation and Context
A step for Koding on K8s. After having a copy of this repository,
./configureis needed to be executed to have a ./run script. If the dependencies regarding Kubernetes are fulfilled,./run k8s startbuilds up a local Kubernetes cluster. As a result, Koding runs on team stack for development :8090How Has This Been Tested?
Services' connectivities are tested via their respective check_connectivity functions.
Types of changes