aboutsummaryrefslogtreecommitdiffstats
path: root/tools/moon_kubernetes
diff options
context:
space:
mode:
Diffstat (limited to 'tools/moon_kubernetes')
-rw-r--r--tools/moon_kubernetes/README.md38
-rw-r--r--tools/moon_kubernetes/conf/moon.conf87
-rw-r--r--tools/moon_kubernetes/conf/ports.conf24
-rw-r--r--tools/moon_kubernetes/init_k8s.sh6
-rw-r--r--tools/moon_kubernetes/start_moon.sh24
-rw-r--r--tools/moon_kubernetes/templates/db.yaml31
-rw-r--r--tools/moon_kubernetes/templates/moon_forming.yaml (renamed from tools/moon_kubernetes/templates/moon_configuration.yaml)14
7 files changed, 143 insertions, 81 deletions
diff --git a/tools/moon_kubernetes/README.md b/tools/moon_kubernetes/README.md
index 7f26d276..a74a1321 100644
--- a/tools/moon_kubernetes/README.md
+++ b/tools/moon_kubernetes/README.md
@@ -28,11 +28,10 @@ apt-get install -y kubelet kubeadm kubectl
```
## Moon Deployment
-### Creation
-Execute the script : `init_k8s.sh`
+### Initiate K8S
```bash
+cd $MOON_HOME/tools/moon_kubernes
sudo bash init_k8s.sh
-watch kubectl get po --namespace=kube-system
```
Wait until all the kubeadm containers are in the `running` state:
@@ -55,11 +54,10 @@ You must see something like this:
kube-scheduler-varuna 1/1 Running 0 1h
-### Execution
-Execute the script : `start_moon.sh`
+### Deploy Moon
```bash
+cd $MOON_HOME/tools/moon_kubernes
sudo bash start_moon.sh
-watch kubectl get po --namespace=moon
```
Wait until all the Moon containers are in the `running` state:
@@ -79,4 +77,30 @@ You must see something like this:
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 \ No newline at end of file
+ wrapper-astonishing-748b7dcc4f-ngsvp 1/1 Running 0 51m
+
+### 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/tools/moon_kubernetes/conf/moon.conf b/tools/moon_kubernetes/conf/moon.conf
new file mode 100644
index 00000000..a5a40ad2
--- /dev/null
+++ b/tools/moon_kubernetes/conf/moon.conf
@@ -0,0 +1,87 @@
+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
+
+plugins:
+ authz:
+ container: wukongsun/moon_authz:v4.3
+ port: 8081
+ session:
+ container: asteroide/session:latest
+ port: 8082
+
+components:
+ interface:
+ port: 8080
+ bind: 0.0.0.0
+ hostname: interface
+ container: wukongsun/moon_interface:v4.3
+ orchestrator:
+ port: 8083
+ bind: 0.0.0.0
+ hostname: orchestrator
+ container: wukongsun/moon_orchestrator:v4.3
+ external:
+ port: 30003
+ hostname: orchestrator
+ wrapper:
+ port: 8080
+ bind: 0.0.0.0
+ hostname: wrapper
+ container: wukongsun/moon_wrapper:v4.3.1
+ timeout: 5
+ manager:
+ port: 8082
+ bind: 0.0.0.0
+ hostname: manager
+ container: wukongsun/moon_manager:v4.3.1
+ 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: brief
+ 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/tools/moon_kubernetes/conf/ports.conf b/tools/moon_kubernetes/conf/ports.conf
deleted file mode 100644
index 487945c0..00000000
--- a/tools/moon_kubernetes/conf/ports.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-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/tools/moon_kubernetes/init_k8s.sh b/tools/moon_kubernetes/init_k8s.sh
index 6eb94e78..ab9a4503 100644
--- a/tools/moon_kubernetes/init_k8s.sh
+++ b/tools/moon_kubernetes/init_k8s.sh
@@ -6,8 +6,8 @@ sudo kubeadm reset
sudo swapoff -a
-sudo kubeadm init --pod-network-cidr=192.168.0.0/16
-#sudo kubeadm init --pod-network-cidr=10.244.0.0/16
+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
@@ -22,7 +22,7 @@ kubectl apply -f http://docs.projectcalico.org/v2.4/getting-started/kubernetes/i
kubectl delete deployment kube-dns --namespace=kube-system
kubectl apply -f kubernetes/templates/kube-dns.yaml
-kubectl taint nodes --all node-role.kubernetes.io/master-
+kubectl taint nodes --all node-role.kubernetes.io/master- # make the master also as a node
kubectl proxy&
sleep 5
diff --git a/tools/moon_kubernetes/start_moon.sh b/tools/moon_kubernetes/start_moon.sh
index 8121e319..3892a3fa 100644
--- a/tools/moon_kubernetes/start_moon.sh
+++ b/tools/moon_kubernetes/start_moon.sh
@@ -5,33 +5,31 @@ set -x
kubectl create namespace moon
kubectl create configmap moon-config --from-file conf/moon.conf -n moon
kubectl create configmap config --from-file ~/.kube/config -n moon
-kubectl create secret generic mysql-root-pass --from-file=kubernetes/conf/password_root.txt -n moon
-kubectl create secret generic mysql-pass --from-file=kubernetes/conf/password_moon.txt -n moon
+kubectl create secret generic mysql-root-pass --from-file=conf/password_root.txt -n moon
+kubectl create secret generic mysql-pass --from-file=conf/password_moon.txt -n moon
-kubectl create -n moon -f kubernetes/templates/consul.yaml
-kubectl create -n moon -f kubernetes/templates/db.yaml
-kubectl create -n moon -f kubernetes/templates/keystone.yaml
+kubectl create -n moon -f templates/consul.yaml
+kubectl create -n moon -f templates/db.yaml
+kubectl create -n moon -f templates/keystone.yaml
echo =========================================
kubectl get pods -n moon
echo =========================================
sleep 10
-kubectl create -n moon -f kubernetes/templates/moon_configuration.yaml
+kubectl create -n moon -f templates/moon_forming.yaml
-echo Waiting for jobs moonforming
+echo Waiting for jobs forming
sleep 5
kubectl get jobs -n moon
-kubectl logs -n moon jobs/moonforming
+kubectl logs -n moon jobs/forming
sleep 5
-
-kubectl create -n moon -f kubernetes/templates/moon_manager.yaml
+kubectl create -n moon -f templates/moon_manager.yaml
sleep 2
+kubectl create -n moon -f templates/moon_orchestrator.yaml
-kubectl create -n moon -f kubernetes/templates/moon_orchestrator.yaml
-
-kubectl create -n moon -f kubernetes/templates/moon_gui.yaml
+kubectl create -n moon -f templates/moon_gui.yaml
diff --git a/tools/moon_kubernetes/templates/db.yaml b/tools/moon_kubernetes/templates/db.yaml
index 38418643..a055507e 100644
--- a/tools/moon_kubernetes/templates/db.yaml
+++ b/tools/moon_kubernetes/templates/db.yaml
@@ -1,33 +1,3 @@
-#apiVersion: v1
-#kind: PersistentVolume
-#metadata:
-# name: local-pv-1
-# labels:
-# type: local
-#spec:
-# capacity:
-# storage: 5Gi
-# accessModes:
-# - ReadWriteOnce
-# hostPath:
-# path: /tmp/data/pv-1
-#---
-#
-#apiVersion: v1
-#kind: PersistentVolumeClaim
-#metadata:
-# name: mysql-pv-claim
-# labels:
-# platform: moon
-# app: db
-#spec:
-# accessModes:
-# - ReadWriteOnce
-# resources:
-# requests:
-# storage: 5Gi
-#---
-
apiVersion: apps/v1beta1
kind: Deployment
metadata:
@@ -71,6 +41,7 @@ spec:
# persistentVolumeClaim:
# claimName: mysql-pv-claim
---
+
apiVersion: v1
kind: Service
metadata:
diff --git a/tools/moon_kubernetes/templates/moon_configuration.yaml b/tools/moon_kubernetes/templates/moon_forming.yaml
index 3bcaa533..efcc51d8 100644
--- a/tools/moon_kubernetes/templates/moon_configuration.yaml
+++ b/tools/moon_kubernetes/templates/moon_forming.yaml
@@ -1,25 +1,31 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: moonforming
+ name: forming
namespace: moon
spec:
template:
metadata:
- name: moonforming
+ name: forming
spec:
containers:
- - name: moonforming
- image: asteroide/moonforming:v1.3
+ - name: forming
+ image: wukongsun/moon_forming:v1.3
env:
- name: POPULATE_ARGS
value: "--verbose" # debug mode: --debug
volumeMounts:
- name: config-volume
mountPath: /etc/moon
+ - name: test-volume
+ mountPath: /data
volumes:
- name: config-volume
configMap:
name: moon-config
+ - name: test-volume
+ hostPath:
+ path: tests/functional/scenario_enabled
+ type: Directory
restartPolicy: Never
#backoffLimit: 4 \ No newline at end of file