diff --git a/docker/scripts-onm/MASTER_INSTALL_SCRIPT.sh b/docker/scripts-onm/MASTER_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..5c686bf --- /dev/null +++ b/docker/scripts-onm/MASTER_INSTALL_SCRIPT.sh @@ -0,0 +1,11 @@ + +echo "Master install script" + +wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/install-kube-u22-wg.sh && chmod +x ./install-kube-u22-wg.sh && ./install-kube-u22-wg.sh + +echo "Installing Helm..." +sudo -H -u ubuntu bash -c ' curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && ./get_helm.sh' +# Add KubeVela Helm repository and update + +sudo -H -u ubuntu bash -c 'curl -fsSl https://kubevela.io/script/install.sh | bash' +echo "Configuration complete." diff --git a/docker/scripts-onm/MASTER_POST_INSTALL_SCRIPT.sh b/docker/scripts-onm/MASTER_POST_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..93f67a6 --- /dev/null +++ b/docker/scripts-onm/MASTER_POST_INSTALL_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "Master post-install script" diff --git a/docker/scripts-onm/MASTER_PRE_INSTALL_SCRIPT.sh b/docker/scripts-onm/MASTER_PRE_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..36eb9dc --- /dev/null +++ b/docker/scripts-onm/MASTER_PRE_INSTALL_SCRIPT.sh @@ -0,0 +1,12 @@ + +echo "Master pre-install script\n" + +sudo hostnamectl set-hostname "$variables_PA_JOB_NAME" +sudo -H -u ubuntu bash -c 'wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/nm-bootstrap-script.sh && chmod +x nm-bootstrap-script.sh' +sudo -H -u ubuntu bash -c "./nm-bootstrap-script.sh 'CREATE' 'MASTER' $APP_UUID $ONM_IP"; +echo "" +echo "" +sleep 60 + +WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`; +echo "WIREGUARD_VPN_IP= $WIREGUARD_VPN_IP"; diff --git a/docker/scripts-onm/MASTER_START_SCRIPT.sh b/docker/scripts-onm/MASTER_START_SCRIPT.sh new file mode 100644 index 0000000..f2da0de --- /dev/null +++ b/docker/scripts-onm/MASTER_START_SCRIPT.sh @@ -0,0 +1,28 @@ + +echo "Master start script" +WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`; +echo "WIREGUARD_VPN_IP= $WIREGUARD_VPN_IP"; + +sudo kubeadm init --apiserver-advertise-address ${WIREGUARD_VPN_IP} --service-cidr 10.96.0.0/16 --pod-network-cidr 10.244.0.0/16 + +echo "HOME: $(pwd), USERE: $(id -u -n)" +mkdir -p ~/.kube && sudo cp -i /etc/kubernetes/admin.conf ~/.kube/config && sudo chown $(id -u):$(id -g) ~/.kube/config +id -u ubuntu &> /dev/null + +if [[ $? -eq 0 ]] +then + #USER ubuntu is found + mkdir -p /home/ubuntu/.kube && sudo cp -i /etc/kubernetes/admin.conf /home/ubuntu/.kube/config && sudo chown ubuntu:ubuntu /home/ubuntu/.kube/config +else + echo "User Ubuntu is not found" +fi + + +#sudo -H -u ubuntu kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml; +sudo -H -u ubuntu bash -c 'helm repo add cilium https://helm.cilium.io/ && helm repo update' +sudo -H -u ubuntu bash -c 'helm install cilium cilium/cilium --namespace kube-system --set encryption.enabled=true --set encryption.type=wireguard' + +echo "Setting KubeVela..." +#sudo -H -u ubuntu bash -c 'helm repo add kubevela https://kubevela.github.io/charts && helm repo update' +#sudo -H -u ubuntu bash -c 'nohup helm install --create-namespace -n vela-system kubevela kubevela/vela-core > /home/ubuntu/vela.txt 2>&1 &' +sudo -H -u ubuntu bash -c 'nohup vela install --version 1.8.2 > /home/ubuntu/vela.txt 2>&1 &' diff --git a/docker/scripts-onm/MASTER_STOP_SCRIPT.sh b/docker/scripts-onm/MASTER_STOP_SCRIPT.sh new file mode 100644 index 0000000..29365e8 --- /dev/null +++ b/docker/scripts-onm/MASTER_STOP_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "Master stop script" diff --git a/docker/scripts-onm/MASTER_UPDATE_SCRIPT.sh b/docker/scripts-onm/MASTER_UPDATE_SCRIPT.sh new file mode 100644 index 0000000..0cca17f --- /dev/null +++ b/docker/scripts-onm/MASTER_UPDATE_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "Master update script" diff --git a/docker/scripts-onm/WORKER_INSTALL_SCRIPT.sh b/docker/scripts-onm/WORKER_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..c5f5e71 --- /dev/null +++ b/docker/scripts-onm/WORKER_INSTALL_SCRIPT.sh @@ -0,0 +1,3 @@ + +echo "Worker install script" +wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/install-kube-u22-wg.sh && chmod +x ./install-kube-u22-wg.sh && ./install-kube-u22-wg.sh diff --git a/docker/scripts-onm/WORKER_POST_INSTALL_SCRIPT.sh b/docker/scripts-onm/WORKER_POST_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..08c3e0e --- /dev/null +++ b/docker/scripts-onm/WORKER_POST_INSTALL_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "worker post-install script" diff --git a/docker/scripts-onm/WORKER_PRE_INSTALL_SCRIPT.sh b/docker/scripts-onm/WORKER_PRE_INSTALL_SCRIPT.sh new file mode 100644 index 0000000..e5e673c --- /dev/null +++ b/docker/scripts-onm/WORKER_PRE_INSTALL_SCRIPT.sh @@ -0,0 +1,8 @@ + +echo "Worker pre-install script" +sudo hostnamectl set-hostname "$variables_PA_JOB_NAME" +sudo -H -u ubuntu bash -c 'wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/nm-bootstrap-script.sh && chmod +x nm-bootstrap-script.sh' +sudo -H -u ubuntu bash -c "./nm-bootstrap-script.sh 'CREATE' 'WORKER' $APP_UUID $ONM_IP"; + +WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`; +echo "WIREGUARD_VPN_IP= $WIREGUARD_VPN_IP"; diff --git a/docker/scripts-onm/WORKER_START_SCRIPT.sh b/docker/scripts-onm/WORKER_START_SCRIPT.sh new file mode 100644 index 0000000..0c021e5 --- /dev/null +++ b/docker/scripts-onm/WORKER_START_SCRIPT.sh @@ -0,0 +1,4 @@ + +echo "Worker start script" +echo $variables_kubeCommand +sudo $variables_kubeCommand diff --git a/docker/scripts-onm/WORKER_STOP_SCRIPT.sh b/docker/scripts-onm/WORKER_STOP_SCRIPT.sh new file mode 100644 index 0000000..8b09a73 --- /dev/null +++ b/docker/scripts-onm/WORKER_STOP_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "Worker stop script" diff --git a/docker/scripts-onm/WORKER_UPDATE_SCRIPT.sh b/docker/scripts-onm/WORKER_UPDATE_SCRIPT.sh new file mode 100644 index 0000000..bf7e0ce --- /dev/null +++ b/docker/scripts-onm/WORKER_UPDATE_SCRIPT.sh @@ -0,0 +1,2 @@ + +echo "Worker update script" diff --git a/docker/scripts/MASTER_START_SCRIPT.sh b/docker/scripts/MASTER_START_SCRIPT.sh index 2677b5a..358a271 100644 --- a/docker/scripts/MASTER_START_SCRIPT.sh +++ b/docker/scripts/MASTER_START_SCRIPT.sh @@ -19,5 +19,6 @@ fi sudo -H -u ubuntu kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml; echo "Setting KubeVela..." -sudo -H -u ubuntu bash -c 'helm repo add kubevela https://kubevela.github.io/charts && helm repo update' -sudo -H -u ubuntu bash -c 'nohup helm install --create-namespace -n vela-system kubevela kubevela/vela-core > /home/ubuntu/vela.txt 2>&1 &' +#sudo -H -u ubuntu bash -c 'helm repo add kubevela https://kubevela.github.io/charts && helm repo update' +#sudo -H -u ubuntu bash -c 'nohup helm install --create-namespace -n vela-system kubevela kubevela/vela-core > /home/ubuntu/vela.txt 2>&1 &' +sudo -H -u ubuntu bash -c 'nohup vela install --version 1.8.2 > /home/ubuntu/vela.txt 2>&1 &' diff --git a/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ClusterUtils.java b/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ClusterUtils.java index 89ed0da..362cb57 100644 --- a/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ClusterUtils.java +++ b/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ClusterUtils.java @@ -210,7 +210,7 @@ public static String createLabelNodesScript(List> nodeLabels script.append(String.format("%s '%s %s-%s %s' \n", CLI_USER_SELECTION, KUBE_LABEL_COMMAND, - nodeName, + nodeName.toLowerCase(), clusterName, label)); } @@ -256,11 +256,10 @@ private static String createAppCommand(ClusterApplication.PackageManagerEnum yam private static String createEnvVarsScript(Map envVars) { String filePath = FILE_PATH; StringBuilder script = new StringBuilder(); - script.append("echo '#!/bin/bash' >> " + filePath + "\n"); for (String key : envVars.keySet()) { script.append(String.format("echo 'export %s=\"%s\"' >> %s\n", key, envVars.get(key), filePath)); } - script.append(String.format("source %s", filePath)); + script.append(String.format("source %s\n", filePath)); return script.toString(); }