Skip to content

Commit

Permalink
adding a the includes operator (#74)
Browse files Browse the repository at this point in the history
* adding a the includes operator

* ONM-integration
  • Loading branch information
alijawadfahs authored Apr 12, 2024
1 parent 7db8af3 commit 4ea3e2f
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 5 deletions.
11 changes: 11 additions & 0 deletions docker/scripts-onm/MASTER_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -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."
2 changes: 2 additions & 0 deletions docker/scripts-onm/MASTER_POST_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "Master post-install script"
12 changes: 12 additions & 0 deletions docker/scripts-onm/MASTER_PRE_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -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";
28 changes: 28 additions & 0 deletions docker/scripts-onm/MASTER_START_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -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 &'
2 changes: 2 additions & 0 deletions docker/scripts-onm/MASTER_STOP_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "Master stop script"
2 changes: 2 additions & 0 deletions docker/scripts-onm/MASTER_UPDATE_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "Master update script"
3 changes: 3 additions & 0 deletions docker/scripts-onm/WORKER_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions docker/scripts-onm/WORKER_POST_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "worker post-install script"
8 changes: 8 additions & 0 deletions docker/scripts-onm/WORKER_PRE_INSTALL_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -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";
4 changes: 4 additions & 0 deletions docker/scripts-onm/WORKER_START_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

echo "Worker start script"
echo $variables_kubeCommand
sudo $variables_kubeCommand
2 changes: 2 additions & 0 deletions docker/scripts-onm/WORKER_STOP_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "Worker stop script"
2 changes: 2 additions & 0 deletions docker/scripts-onm/WORKER_UPDATE_SCRIPT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

echo "Worker update script"
5 changes: 3 additions & 2 deletions docker/scripts/MASTER_START_SCRIPT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &'
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static String createLabelNodesScript(List<Map<String, String>> nodeLabels
script.append(String.format("%s '%s %s-%s %s' \n",
CLI_USER_SELECTION,
KUBE_LABEL_COMMAND,
nodeName,
nodeName.toLowerCase(),
clusterName,
label));
}
Expand Down Expand Up @@ -256,11 +256,10 @@ private static String createAppCommand(ClusterApplication.PackageManagerEnum yam
private static String createEnvVarsScript(Map<String, String> 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();
}

Expand Down

0 comments on commit 4ea3e2f

Please sign in to comment.