diff options
author | 2020-06-03 10:06:52 +0200 | |
---|---|---|
committer | 2020-06-03 10:06:52 +0200 | |
commit | 7bb53c64da2dcf88894bfd31503accdd81498f3d (patch) | |
tree | 4310e12366818af27947b5e2c80cb162da93a4b5 /old/tools/moon_kubernetes | |
parent | cbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff) |
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com>
Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'old/tools/moon_kubernetes')
-rw-r--r-- | old/tools/moon_kubernetes/README.md | 141 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/conf/moon.conf | 90 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/conf/password_moon.txt | 1 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/conf/password_root.txt | 1 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/init_k8s_moon.sh | 280 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/consul.yaml | 33 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/db.yaml | 55 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/keystone.yaml | 39 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/kube-dns.yaml | 183 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/moon_forming.yaml | 30 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/moon_functest.yaml | 27 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/moon_gui.yaml | 42 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/moon_manager.yaml | 33 | ||||
-rw-r--r-- | old/tools/moon_kubernetes/templates/moon_orchestrator.yaml | 40 |
14 files changed, 995 insertions, 0 deletions
diff --git a/old/tools/moon_kubernetes/README.md b/old/tools/moon_kubernetes/README.md new file mode 100644 index 00000000..e75fe086 --- /dev/null +++ b/old/tools/moon_kubernetes/README.md @@ -0,0 +1,141 @@ +# Moon Platform Setup +## Docker Installation +```bash +apt update +apt install -y docker.io +``` + +## K8S Installation +Choose the right K8S platform +### Minikube +```bash +curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl +chmod +x ./kubectl +sudo mv ./kubectl /usr/local/bin/kubectl +curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.21.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ +``` + +### Kubeadm +see: https://kubernetes.io/docs/setup/independent/install-kubeadm/ +```bash +apt-get update && apt-get install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +cat <<EOF >/etc/apt/sources.list.d/kubernetes.list +deb http://apt.kubernetes.io/ kubernetes-xenial main +EOF +apt-get update +apt-get install -y kubelet kubeadm kubectl +``` + +## Moon Deployment +### Deploy kubernete and moon +```bash +cd $MOON_HOME +bash tools/moon_kubernetes/init_k8s_moon.sh +``` +This will wait for kubernetes and then moon to be up + +To check that the platform is running correctely, +```bash +watch kubectl get po --namespace=kube-system +``` +You must see something like this: + + $ kubectl get po --namespace=kube-system + NAME READY STATUS RESTARTS AGE + calico-etcd-7qgjb 1/1 Running 0 1h + calico-node-f8zvm 2/2 Running 1 1h + calico-policy-controller-59fc4f7888-ns9kv 1/1 Running 0 1h + etcd-varuna 1/1 Running 0 1h + kube-apiserver-varuna 1/1 Running 0 1h + kube-controller-manager-varuna 1/1 Running 0 1h + kube-dns-bfbb49cd7-rgqxn 3/3 Running 0 1h + kube-proxy-x88wg 1/1 Running 0 1h + kube-scheduler-varuna 1/1 Running 0 1h + +```bash +watch kubectl get po --namespace=moon +``` + +You must see something like this: + + $ kubectl get po --namespace=moon + NAME READY STATUS RESTARTS AGE + consul-57b6d66975-9qnfx 1/1 Running 0 52m + db-867f9c6666-bq8cf 1/1 Running 0 52m + gui-bc9878b58-q288x 1/1 Running 0 51m + keystone-7d9cdbb69f-bl6ln 1/1 Running 0 52m + manager-5bfbb96988-2nvhd 1/1 Running 0 51m + manager-5bfbb96988-fg8vj 1/1 Running 0 51m + manager-5bfbb96988-w9wnk 1/1 Running 0 51m + orchestrator-65d8fb4574-tnfx2 1/1 Running 0 51m + wrapper-astonishing-748b7dcc4f-ngsvp 1/1 Running 0 51m + + +### Deploy or redeploy Moon only + +Kubernete shall be running. + +```bash +cd $MOON_HOME +sudo bash tools/moon_kubernetes/init_k8s_moon.sh moon +``` + + +### Troubleshoot +check *Consul* for: +- *Components/Manager*, e.g. +```json +{ + "port": 8082, + "bind": "0.0.0.0", + "hostname": "manager", + "container": "wukongsun/moon_manager:v4.3.1", + "external": { + "port": 30001, + "hostname": "$MOON_HOST" + } +} +``` +- *OpenStack/Keystone*: e.g. +```json +{ + "url": "http://keystone:5000/v3", + "user": "admin", + "password": "p4ssw0rd", + "domain": "default", + "project": "admin", + "check_token": false, + "certificate": false, + "external": { + "url": "http://$MOON_HOST:30006/v3" + } +} +``` + + +### Docker-K8S Port Mapping +```yamlex +manager: + port: 8082 + kport: 30001 +gui: + port: 3000 + kport: 30002 +orchestrator: + port: 8083 + kport: 30003 +consul: + port: 8500 + kport: 30005 +keystone: + port: 5000 + kport: 30006 +wrapper: + port: 8080 + kport: 30010 +interface: + port: 8080 +authz: + port: 8081 +``` diff --git a/old/tools/moon_kubernetes/conf/moon.conf b/old/tools/moon_kubernetes/conf/moon.conf new file mode 100644 index 00000000..5fc94edd --- /dev/null +++ b/old/tools/moon_kubernetes/conf/moon.conf @@ -0,0 +1,90 @@ +database: + url: mysql+pymysql://moon:p4sswOrd1@db/moon + driver: sql + +openstack: + keystone: + url: http://keystone:5000/v3 + user: admin + password: p4ssw0rd + domain: default + project: admin + check_token: false + certificate: false + external: + url: http://keystone:30006/v3 + +components: + port_start: + 31001 + pipeline: + interface: + port: 8080 + bind: 0.0.0.0 + hostname: interface + container: moonplatform/moon_interface:latest + authz: + port: 8081 + bind: 0.0.0.0 + hostname: interface + container: moonplatform/moon_authz:latest + session: + container: asteroide/session:latest + port: 8082 + orchestrator: + port: 8083 + bind: 0.0.0.0 + hostname: orchestrator + container: moonplatform/moon_orchestrator:latest + external: + port: 30003 + hostname: orchestrator + wrapper: + port: 8080 + bind: 0.0.0.0 + hostname: wrapper + container: moonplatform/moon_wrapper:latest + timeout: 5 + manager: + port: 8082 + bind: 0.0.0.0 + hostname: manager + container: moonplatform/moon_manager:latest + external: + port: 30001 + hostname: manager + port_start: 31001 + +logging: + version: 1 + + formatters: + brief: + format: "%(levelname)s %(name)s %(message)-30s" + custom: + format: "%(asctime)-15s %(levelname)s %(name)s %(message)s" + + handlers: + console: + class : logging.StreamHandler + formatter: custom + level : INFO + stream : ext://sys.stdout + file: + class : logging.handlers.RotatingFileHandler + formatter: custom + level : DEBUG + filename: /tmp/moon.log + maxBytes: 1048576 + backupCount: 3 + + loggers: + moon: + level: DEBUG + handlers: [console, file] + propagate: no + + root: + level: ERROR + handlers: [console] + diff --git a/old/tools/moon_kubernetes/conf/password_moon.txt b/old/tools/moon_kubernetes/conf/password_moon.txt new file mode 100644 index 00000000..bb9bcf7d --- /dev/null +++ b/old/tools/moon_kubernetes/conf/password_moon.txt @@ -0,0 +1 @@ +p4sswOrd1
\ No newline at end of file diff --git a/old/tools/moon_kubernetes/conf/password_root.txt b/old/tools/moon_kubernetes/conf/password_root.txt new file mode 100644 index 00000000..bb9bcf7d --- /dev/null +++ b/old/tools/moon_kubernetes/conf/password_root.txt @@ -0,0 +1 @@ +p4sswOrd1
\ No newline at end of file diff --git a/old/tools/moon_kubernetes/init_k8s_moon.sh b/old/tools/moon_kubernetes/init_k8s_moon.sh new file mode 100644 index 00000000..0617de86 --- /dev/null +++ b/old/tools/moon_kubernetes/init_k8s_moon.sh @@ -0,0 +1,280 @@ +#!/bin/bash +#number of pods type that should be running or be stopped +declare -i pods_to_check=0 + #global variable on current namespace to check +current_namespace="" +#if set to 1 we check that the pods are running, otherwise we chack that the pods are stopped +declare -i check_running=1 +#name of the pod to check +match_pattern="" +#postfix used to recognize pods name +OS="unknown_os" + +#this function checks if a pod with name starting with $1 is in the Running / Stopped state depending on $heck_running +# $1 : the name the pods starts with (without the random string added by kubernate to the pod name) +# $2 : either the number of identical pods that shall be run or # +# $3 : if $2 is #, the number of lines of the pods name appear on which the pod appears +function check_pod() { + declare -i nb_arguments=$# + match_pattern="$1"; shift + if [ $nb_arguments -gt 2 ]; then + shift; declare -i nb_pods_pattern="$1" + if [ $check_running -eq 1 ]; then #check if pods are running + declare -i result=$(sudo kubectl get po --namespace=${current_namespace} | grep $match_pattern | grep "1/1" | grep -c "Running") + if [ $result -eq $nb_pods_pattern ]; then + pods_to_check=$pods_to_check+1 + fi + else #check if pods are stopped + declare -i result=$(sudo kubectl get po --namespace=${current_namespace} | grep $match_pattern | grep -c "Running\|Terminating") + if [ $result -eq 0 ]; then + pods_to_check=$pods_to_check+1 + fi + fi + else + declare -i nb=$1 + if [ $check_running -eq 1 ]; then #check if pods are running + declare -i result=$(sudo kubectl get po --namespace=${current_namespace} | grep $match_pattern | grep "$nb/$nb" | grep -c "Running") + if [ $result -eq 1 ]; then + pods_to_check=$pods_to_check+1 + fi + else #check if pods are stopped + declare -i result=$(sudo kubectl get po --namespace=${current_namespace} | grep $match_pattern | grep -c "Running\|Terminating") + if [ $result -eq 0 ]; then + pods_to_check=$pods_to_check+1 + fi + fi + fi +} + +#this function tests a list of pods +function check_pods() { + current_namespace="${1}"; shift + pods=("${@}") + declare -i pods_nb=${#pods[@]} + sleep 2 + while [ $pods_to_check -lt $pods_nb ] + do + pods_to_check=0 + for node in "${pods[@]}" + do + check_pod $node + done + + if [ $check_running -eq 1 ]; then + echo -ne "$pods_to_check node types on $pods_nb are running...\033[0K\r" + else + declare -i running_pods=$pods_nb-$pods_to_check + echo -ne "$running_pods node types on $pods_nb are still running...\033[0K\r" + fi + sleep 2 + done +} + +#this function checks if a list of pods ($2) in a specific namspace ($1) are in the Running state +function check_pods_running() { + check_running=1 + check_pods "${@}" + pods_to_check=0 +} + +#this function checks if a list of pods ($2) are not in a specific namspace ($1) +function check_pods_not_running() { + check_running=0 + check_pods "${@}" + pods_to_check=0 +} + +function wait_for_kubernate_calico() { + echo -ne "Waiting for kubernate... " + kube_namespace="kube-system" + declare -a kube_pods=("calico-etcd 1" "calico-node 2" "calico-policy-controller 1" "etcd-${OS} 1" "kube-apiserver-${OS} 1" "kube-controller-manager-${OS} 1" "kube-dns 3" "kube-proxy 1" "kube-scheduler-${OS} 1") + check_pods_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_init() { + echo "Waiting for moon (consul, db, keystone) ..." + kube_namespace="moon" + declare -a kube_pods=("consul 1" "db 1" "keystone 1") + check_pods_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_forming() { + echo "Waiting for moon (forming) ..." + kube_namespace="moon" + declare -a kube_pods=("forming 1") + check_pods_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_manager() { + echo "Waiting for moon (manager) ..." + kube_namespace="moon" + declare -a kube_pods=("manager # 1") + check_pods_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_end() { + echo "Waiting for moon (orchestrator, gui) ..." + kube_namespace="moon" + declare -a kube_pods=("gui 1" "orchestrator 1") + check_pods_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_forming_to_end() { + echo "Waiting for moon forming to finish initialization. This can take few minutes..." + kube_namespace="moon" + declare -a kube_pods=("forming 1") + check_pods_not_running "$kube_namespace" "${kube_pods[@]}" +} + +function wait_for_moon_delete_to_end(){ + echo "Waiting for moon to terminate..." + kube_namespace="moon" + declare -a kube_pods=("consul 1" "db 1" "keystone 1" "manager # 3" "gui 1" "orchestrator 1") + check_pods_not_running "$kube_namespace" "${kube_pods[@]}" +} + +function check_os(){ + if [ -f /etc/os-release ]; then + # freedesktop.org and systemd + . /etc/os-release + OS=${ID} + elif type lsb_release >/dev/null 2>&1; then + # linuxbase.org + OS=$(lsb_release -si) + declare -i result=$(grep -i "debian" $OS) + if [ $result -eq 1 ]; then + OS="debian" + fi + declare -i result=$(grep -i "ubuntu" $OS) + if [ $result -eq 1 ]; then + OS="ubuntu" + fi + elif [ -f /etc/lsb-release ]; then + # For some versions of Debian/Ubuntu without lsb_release command + . /etc/lsb-release + OS=$DISTRIB_ID + declare -i result=$(grep -i "debian" $OS) + if [ $result -eq 1 ]; then + OS="debian" + fi + declare -i result=$(grep -i "ubuntu" $OS) + if [ $result -eq 1 ]; then + OS="ubuntu" + fi + elif [ -f /etc/debian_version ]; then + # Older Debian/Ubuntu/etc. + declare -i result=$(grep -i "debian" $OS) + if [ $result -eq 1 ]; then + OS="debian" + fi + declare -i result=$(grep -i "ubuntu" $OS) + if [ $result -eq 1 ]; then + OS="ubuntu" + fi + elif [ -f /etc/SuSe-release ]; then + # Older SuSE/etc. + echo "TO DO : get the name of the OS at the end of the pods name" + elif [ -f /etc/redhat-release ]; then + # Older Red Hat, CentOS, etc. + echo "TO DO : get the name of the OS at the end of the pods name" + else + # Fall back to uname, e.g. "Linux <version>", also works for BSD, etc. + OS=$(uname -s) + echo "TO DO : get the name of the OS at the end of the pods name" + fi + echo "postfix used to detect pods name : ${OS}" +} + +declare -i nb_arguments=$# +declare -i init_kubernate=1 + +if [ $# -eq 1 ]; then + if [ $1 == "moon" ]; then + init_kubernate=0 + fi + + if [ $1 == "-h" ]; then + echo "Usage : " + echo " - 'bash tools/moon_kubernetes/init_k8s_moon.sh' launches the kubernates platform and the moon platform." + echo " - 'bash tools/moon_kubernetes/init_k8s_moon.sh moon' launches the moon platform only. If the moon platform is already launched, it deletes and recreates it." + echo " " + fi +fi + +if [ $init_kubernate -eq 1 ]; then + check_os + echo "==============================" + echo "Launching kubernate " + echo "==============================" + sudo kubeadm reset + sudo swapoff -a + sudo kubeadm init --pod-network-cidr=192.168.0.0/16 # network for Calico + #sudo kubeadm init --pod-network-cidr=10.244.0.0/16 # network for Canal + + mkdir -p $HOME/.kube + sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config + sudo chown $(id -u):$(id -g) $HOME/.kube/config + + kubectl apply -f http://docs.projectcalico.org/v2.4/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml + #kubectl apply -f https://raw.githubusercontent.com/projectcalico/canal/master/k8s-install/1.6/rbac.yaml + #kubectl apply -f https://raw.githubusercontent.com/projectcalico/canal/master/k8s-install/1.6/canal.yaml + #kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml + + kubectl delete deployment kube-dns --namespace=kube-system + kubectl apply -f tools/moon_kubernetes/templates/kube-dns.yaml + kubectl taint nodes --all node-role.kubernetes.io/master- # malke the master also as a node + + kubectl proxy& + + wait_for_kubernate_calico + + echo "==============================" + echo "Kubernate platform is ready ! " + echo "==============================" +fi + +echo "============================" +echo "Launching moon " +echo "============================" +#check if the moon platform is running, if so we terminate it +declare -i moon_is_running=$(sudo kubectl get namespace | grep -c moon) +if [ $moon_is_running -eq 1 ]; then + sudo kubectl delete namespace moon + wait_for_moon_delete_to_end + sleep 2 +fi + +#launching moon +kubectl create namespace moon +kubectl create configmap moon-config --from-file tools/moon_kubernetes/conf/moon.conf -n moon +kubectl create configmap config --from-file ~/.kube/config -n moon +kubectl create configmap moon-policy-templates --from-file tests/functional/scenario_tests -n moon +kubectl create secret generic mysql-root-pass --from-file=tools/moon_kubernetes/conf/password_root.txt -n moon +kubectl create secret generic mysql-pass --from-file=tools/moon_kubernetes/conf/password_moon.txt -n moon + +kubectl create -n moon -f tools/moon_kubernetes/templates/consul.yaml +kubectl create -n moon -f tools/moon_kubernetes/templates/db.yaml +kubectl create -n moon -f tools/moon_kubernetes/templates/keystone.yaml +wait_for_moon_init + + +kubectl create -n moon -f tools/moon_kubernetes/templates/moon_forming.yaml +wait_for_moon_forming + + +kubectl create -n moon -f tools/moon_kubernetes/templates/moon_manager.yaml +wait_for_moon_manager + + +kubectl create -n moon -f tools/moon_kubernetes/templates/moon_orchestrator.yaml +kubectl create -n moon -f tools/moon_kubernetes/templates/moon_gui.yaml +wait_for_moon_end + +#wait the end of pods initialization performed by moon forming +wait_for_moon_forming_to_end + +echo "========================== " +echo "Moon platform is ready !" +echo "==========================" + + diff --git a/old/tools/moon_kubernetes/templates/consul.yaml b/old/tools/moon_kubernetes/templates/consul.yaml new file mode 100644 index 00000000..f0fb764e --- /dev/null +++ b/old/tools/moon_kubernetes/templates/consul.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: moon + name: consul +spec: + replicas: 1 + template: + metadata: + labels: + app: consul + spec: + hostname: consul + containers: + - name: consul + image: consul:latest + ports: + - containerPort: 8500 +--- + +apiVersion: v1 +kind: Service +metadata: + name: consul + namespace: moon +spec: + ports: + - port: 8500 + targetPort: 8500 + nodePort: 30005 + selector: + app: consul + type: NodePort diff --git a/old/tools/moon_kubernetes/templates/db.yaml b/old/tools/moon_kubernetes/templates/db.yaml new file mode 100644 index 00000000..5a0e5e98 --- /dev/null +++ b/old/tools/moon_kubernetes/templates/db.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: moon + name: db +spec: + replicas: 1 + strategy: + type: Recreate + template: + metadata: + labels: + app: db + spec: + containers: + - name: db + image: mysql:5.7 + env: + - name: MYSQL_DATABASE + value: "moon" + - name: MYSQL_USER + value: "moon" + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password_moon.txt + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-root-pass + key: password_root.txt + ports: + - containerPort: 3306 + name: mysql +# volumeMounts: +# - name: mysql-persistent-storage +# mountPath: /var/lib/mysql +# volumes: +# - name: mysql-persistent-storage +# persistentVolumeClaim: +# claimName: mysql-pv-claim +--- + +apiVersion: v1 +kind: Service +metadata: + namespace: moon + name: db +spec: + ports: + - port: 3306 + selector: + app: db +---
\ No newline at end of file diff --git a/old/tools/moon_kubernetes/templates/keystone.yaml b/old/tools/moon_kubernetes/templates/keystone.yaml new file mode 100644 index 00000000..e4218e4c --- /dev/null +++ b/old/tools/moon_kubernetes/templates/keystone.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: moon + name: keystone +spec: + replicas: 1 + template: + metadata: + labels: + app: keystone + spec: + hostname: keystone + containers: + - name: keystone + image: asteroide/keystone:pike-cors + env: + - name: KEYSTONE_HOSTNAME + value: "127.0.0.1" + - name: KEYSTONE_PORT + value: "30006" + ports: + - containerPort: 35357 + containerPort: 5000 +--- + +apiVersion: v1 +kind: Service +metadata: + name: keystone + namespace: moon +spec: + ports: + - port: 5000 + targetPort: 5000 + nodePort: 30006 + selector: + app: keystone + type: NodePort diff --git a/old/tools/moon_kubernetes/templates/kube-dns.yaml b/old/tools/moon_kubernetes/templates/kube-dns.yaml new file mode 100644 index 00000000..c8f18fd8 --- /dev/null +++ b/old/tools/moon_kubernetes/templates/kube-dns.yaml @@ -0,0 +1,183 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "2" + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{"deployment.kubernetes.io/revision":"1"},"creationTimestamp":"2017-10-30T09:03:59Z","generation":1,"labels":{"k8s-app":"kube-dns"},"name":"kube-dns","namespace":"kube-system","resourceVersion":"556","selfLink":"/apis/extensions/v1beta1/namespaces/kube-system/deployments/kube-dns","uid":"4433b709-bd51-11e7-a055-80fa5b15034a"},"spec":{"replicas":1,"selector":{"matchLabels":{"k8s-app":"kube-dns"}},"strategy":{"rollingUpdate":{"maxSurge":"10%","maxUnavailable":0},"type":"RollingUpdate"},"template":{"metadata":{"creationTimestamp":null,"labels":{"k8s-app":"kube-dns"}},"spec":{"affinity":{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"beta.kubernetes.io/arch","operator":"In","values":["amd64"]}]}]}}},"containers":[{"args":["--domain=cluster.local.","--dns-port=10053","--config-dir=/kube-dns-config","--v=2"],"env":[{"name":"PROMETHEUS_PORT","value":"10055"}],"image":"gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.5","imagePullPolicy":"IfNotPresent","livenessProbe":{"failureThreshold":5,"httpGet":{"path":"/healthcheck/kubedns","port":10054,"scheme":"HTTP"},"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5},"name":"kubedns","ports":[{"containerPort":10053,"name":"dns-local","protocol":"UDP"},{"containerPort":10053,"name":"dns-tcp-local","protocol":"TCP"},{"containerPort":10055,"name":"metrics","protocol":"TCP"}],"readinessProbe":{"failureThreshold":3,"httpGet":{"path":"/readiness","port":8081,"scheme":"HTTP"},"initialDelaySeconds":3,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5},"resources":{"limits":{"memory":"170Mi"},"requests":{"cpu":"100m","memory":"70Mi"}},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/kube-dns-config","name":"kube-dns-config"}]},{"args":["-v=2","-logtostderr","-configDir=/etc/k8s/dns/dnsmasq-nanny","-restartDnsmasq=true","--","-k","--cache-size=1000","--log-facility=-","--server=/cluster.local/127.0.0.1#10053","--server=/in-addr.arpa/127.0.0.1#10053","--server=/ip6.arpa/127.0.0.1#10053","--server=8.8.8.8"],"image":"gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5","imagePullPolicy":"IfNotPresent","livenessProbe":{"failureThreshold":5,"httpGet":{"path":"/healthcheck/dnsmasq","port":10054,"scheme":"HTTP"},"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5},"name":"dnsmasq","ports":[{"containerPort":53,"name":"dns","protocol":"UDP"},{"containerPort":53,"name":"dns-tcp","protocol":"TCP"}],"resources":{"requests":{"cpu":"150m","memory":"20Mi"}},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/etc/k8s/dns/dnsmasq-nanny","name":"kube-dns-config"}]},{"args":["--v=2","--logtostderr","--probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.cluster.local,5,A","--probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.cluster.local,5,A"],"image":"gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.5","imagePullPolicy":"IfNotPresent","livenessProbe":{"failureThreshold":5,"httpGet":{"path":"/metrics","port":10054,"scheme":"HTTP"},"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5},"name":"sidecar","ports":[{"containerPort":10054,"name":"metrics","protocol":"TCP"}],"resources":{"requests":{"cpu":"10m","memory":"20Mi"}},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File"}],"dnsPolicy":"Default","restartPolicy":"Always","schedulerName":"default-scheduler","securityContext":{},"serviceAccount":"kube-dns","serviceAccountName":"kube-dns","terminationGracePeriodSeconds":30,"tolerations":[{"key":"CriticalAddonsOnly","operator":"Exists"},{"effect":"NoSchedule","key":"node-role.kubernetes.io/master"}],"volumes":[{"configMap":{"defaultMode":420,"name":"kube-dns","optional":true},"name":"kube-dns-config"}]}}},"status":{"availableReplicas":1,"conditions":[{"lastTransitionTime":"2017-10-30T09:05:11Z","lastUpdateTime":"2017-10-30T09:05:11Z","message":"Deployment has minimum availability.","reason":"MinimumReplicasAvailable","status":"True","type":"Available"}],"observedGeneration":1,"readyReplicas":1,"replicas":1,"updatedReplicas":1}} + creationTimestamp: 2017-10-30T09:03:59Z + generation: 2 + labels: + k8s-app: kube-dns + name: kube-dns + namespace: kube-system + resourceVersion: "300076" + selfLink: /apis/extensions/v1beta1/namespaces/kube-system/deployments/kube-dns + uid: 4433b709-bd51-11e7-a055-80fa5b15034a +spec: + replicas: 1 + selector: + matchLabels: + k8s-app: kube-dns + strategy: + rollingUpdate: + maxSurge: 10% + maxUnavailable: 0 + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + k8s-app: kube-dns + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: beta.kubernetes.io/arch + operator: In + values: + - amd64 + containers: + - args: + - --domain=cluster.local. + - --dns-port=10053 + - --config-dir=/kube-dns-config + - --v=2 + env: + - name: PROMETHEUS_PORT + value: "10055" + image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.5 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthcheck/kubedns + port: 10054 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: kubedns + ports: + - containerPort: 10053 + name: dns-local + protocol: UDP + - containerPort: 10053 + name: dns-tcp-local + protocol: TCP + - containerPort: 10055 + name: metrics + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readiness + port: 8081 + scheme: HTTP + initialDelaySeconds: 3 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + resources: + limits: + memory: 340Mi + requests: + cpu: 200m + memory: 140Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /kube-dns-config + name: kube-dns-config + - args: + - -v=2 + - -logtostderr + - -configDir=/etc/k8s/dns/dnsmasq-nanny + - -restartDnsmasq=true + - -- + - -k + - --dns-forward-max=300 + - --cache-size=1000 + - --log-facility=- + - --server=/cluster.local/127.0.0.1#10053 + - --server=/in-addr.arpa/127.0.0.1#10053 + - --server=/ip6.arpa/127.0.0.1#10053 + - --server=8.8.8.8 + image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.5 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthcheck/dnsmasq + port: 10054 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: dnsmasq + ports: + - containerPort: 53 + name: dns + protocol: UDP + - containerPort: 53 + name: dns-tcp + protocol: TCP + resources: + requests: + cpu: 150m + memory: 20Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/k8s/dns/dnsmasq-nanny + name: kube-dns-config + - args: + - --v=2 + - --logtostderr + - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.cluster.local,5,A + - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.cluster.local,5,A + image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.5 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 5 + httpGet: + path: /metrics + port: 10054 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: sidecar + ports: + - containerPort: 10054 + name: metrics + protocol: TCP + resources: + requests: + cpu: 10m + memory: 20Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: Default + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: kube-dns + serviceAccountName: kube-dns + terminationGracePeriodSeconds: 30 + tolerations: + - key: CriticalAddonsOnly + operator: Exists + - effect: NoSchedule + key: node-role.kubernetes.io/master + volumes: + - configMap: + defaultMode: 420 + name: kube-dns + optional: true + name: kube-dns-config diff --git a/old/tools/moon_kubernetes/templates/moon_forming.yaml b/old/tools/moon_kubernetes/templates/moon_forming.yaml new file mode 100644 index 00000000..1214a41a --- /dev/null +++ b/old/tools/moon_kubernetes/templates/moon_forming.yaml @@ -0,0 +1,30 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: forming + namespace: moon +spec: + template: + metadata: + name: forming + spec: + containers: + - name: forming + image: moonplatform/moon_forming:latest + env: + - name: POPULATE_ARGS + value: "--verbose" # debug mode: --debug + volumeMounts: + - name: config-volume + mountPath: /etc/moon + - name: templates-volume + mountPath: /data + volumes: + - name: config-volume + configMap: + name: moon-config + - name: templates-volume + configMap: + name: moon-policy-templates + restartPolicy: Never + #backoffLimit: 4
\ No newline at end of file diff --git a/old/tools/moon_kubernetes/templates/moon_functest.yaml b/old/tools/moon_kubernetes/templates/moon_functest.yaml new file mode 100644 index 00000000..e876849e --- /dev/null +++ b/old/tools/moon_kubernetes/templates/moon_functest.yaml @@ -0,0 +1,27 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: functest + namespace: moon +spec: + template: + metadata: + name: functest + spec: + containers: + - name: functest + image: moonplatform/moon_python_func_test:latest + volumeMounts: + - name: config-volume + mountPath: /etc/moon + - name: tests-volume + mountPath: /data + volumes: + - name: config-volume + configMap: + name: moon-config + - name: tests-volume + hostPath: + path: "{{PATH}}" + restartPolicy: Never + #backoffLimit: 4 diff --git a/old/tools/moon_kubernetes/templates/moon_gui.yaml b/old/tools/moon_kubernetes/templates/moon_gui.yaml new file mode 100644 index 00000000..eca4267d --- /dev/null +++ b/old/tools/moon_kubernetes/templates/moon_gui.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: moon + name: gui +spec: + replicas: 1 + template: + metadata: + labels: + app: gui + spec: + hostname: gui + containers: + - name: gui + image: moonplatform/moon_gui:latest + env: + - name: MANAGER_HOST + value: "127.0.0.1" + - name: MANAGER_PORT + value: "30001" + - name: KEYSTONE_HOST + value: "127.0.0.1" + - name: KEYSTONE_PORT + value: "30006" + ports: + - containerPort: 80 +--- + +apiVersion: v1 +kind: Service +metadata: + name: gui + namespace: moon +spec: + ports: + - port: 80 + targetPort: 80 + nodePort: 30002 + selector: + app: gui + type: NodePort diff --git a/old/tools/moon_kubernetes/templates/moon_manager.yaml b/old/tools/moon_kubernetes/templates/moon_manager.yaml new file mode 100644 index 00000000..8eb59482 --- /dev/null +++ b/old/tools/moon_kubernetes/templates/moon_manager.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: manager + namespace: moon +spec: + replicas: 1 + template: + metadata: + labels: + app: manager + spec: + hostname: manager + containers: + - name: manager + image: moonplatform/moon_manager:latest + ports: + - containerPort: 8082 +--- + +apiVersion: v1 +kind: Service +metadata: + name: manager + namespace: moon +spec: + ports: + - port: 8082 + targetPort: 8082 + nodePort: 30001 + selector: + app: manager + type: NodePort diff --git a/old/tools/moon_kubernetes/templates/moon_orchestrator.yaml b/old/tools/moon_kubernetes/templates/moon_orchestrator.yaml new file mode 100644 index 00000000..a4ae2bd9 --- /dev/null +++ b/old/tools/moon_kubernetes/templates/moon_orchestrator.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + namespace: moon + name: orchestrator +spec: + replicas: 1 + template: + metadata: + labels: + app: orchestrator + spec: + hostname: orchestrator + containers: + - name: orchestrator + image: moonplatform/moon_orchestrator:latest + ports: + - containerPort: 8083 + volumeMounts: + - name: config-volume + mountPath: /root/.kube + volumes: + - name: config-volume + configMap: + name: config +--- + +apiVersion: v1 +kind: Service +metadata: + name: orchestrator + namespace: moon +spec: + ports: + - port: 8083 + targetPort: 8083 + nodePort: 30003 + selector: + app: orchestrator + type: NodePort |