Skip to content

Commit

Permalink
Merge branch 'fluidos-project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Iqqdd99 authored Jun 14, 2024
2 parents 420480e + 34b64e7 commit 6b64841
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
A FLUIDOS node is a Kubernetes cluster, orchestrated by a single control plane instance, and it can be composed of either a single machine (e.g., an embedded device) or a set of servers (e.g., a datacenter).
Device homogeneity is desired in order to simplify the management (physical servers can be considered all equals, since they feature a similar amount of hardware resources), but it is not requested within a FLUIDOS node. In other words, a FLUIDOS node corresponds to a *Kubernetes cluster*.

A FLUIDOS node handles problems such as orchestrating computing, storage, network resources and software services within the cluster and, thanks to [Liqo](https://liqo.io), can transparently access to resources and services that are running in another (remote) Kubernetes cluster (a.k.a. remote FLUIDOS node).
A FLUIDOS node handles problems such as orchestrating computing, storage, network resources and software services within the cluster and, thanks to [Liqo](https://liqo.io), can transparently access to resources and services that are running in another (remote) Kubernetes cluster (a.k.a. remote FLUIDOS node).

## What can I find in this repo?

Expand Down
32 changes: 22 additions & 10 deletions tools/scripts/installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ function install_components() {
# Get the local resource manager installation boolean from parameters
local_resource_manager=$4

# Get the kubernetes clusters type from parameters
kubernetes_clusters=$5

helm repo add fluidos https://fluidos-project.github.io/node/

consumer_node_port=30000
Expand Down Expand Up @@ -167,18 +170,25 @@ function install_components() {

echo "Providers IPs for cluster $cluster: ${providers_ips[$cluster]}"

# Set the KUBECONFIG environment variable taking the value
export KUBECONFIG
KUBECONFIG=$(echo "${clusters[$cluster]}" | jq -r '.kubeconfig')
# Get the kubeconfig file which depends on variable kubernetes_clusters
KUBECONFIG=$(jq -r '.kubeconfig' <<< "${clusters[$cluster]}")


echo "The KUBECONFIG is $KUBECONFIG"

# Apply the metrics-server
kubectl apply -f "$SCRIPT_DIR"/../../quickstart/utils/metrics-server.yaml --kubeconfig "$KUBECONFIG"
# Check if metrics-server is installed
echo "Checking if metrics-server is installed"
if ! kubectl get deployment metrics-server -n kube-system --kubeconfig "$KUBECONFIG" &>/dev/null; then
echo "Metrics-server is not installed. Installing it..."
# Apply the metrics-server
kubectl apply -f "$SCRIPT_DIR"/../../quickstart/utils/metrics-server.yaml --kubeconfig "$KUBECONFIG"

# Wait for the metrics-server to be ready
echo "Waiting for metrics-server to be ready"
kubectl wait --for=condition=ready pod -l k8s-app=metrics-server -n kube-system --timeout=300s --kubeconfig "$KUBECONFIG"
# Wait for the metrics-server to be ready
echo "Waiting for metrics-server to be ready"
kubectl wait --for=condition=ready pod -l k8s-app=metrics-server -n kube-system --timeout=300s --kubeconfig "$KUBECONFIG"
else
echo "Metrics-server is already installed"
fi

# Decide value file to use based on the role of the cluster
if [ "$(jq -r '.role' <<< "${clusters[$cluster]}")" == "consumer" ]; then
Expand Down Expand Up @@ -230,11 +240,13 @@ function install_components() {
fi

echo "Installing LIQO in cluster $cluster"
liqoctl install kind \
echo "Cluster type is $kubernetes_clusters"
liqoctl install "$kubernetes_clusters" \
--cluster-name "$cluster" \
--set controllerManager.config.resourcePluginAddress=node-rear-controller-grpc.fluidos:2710 \
--set controllerManager.config.enableResourceEnforcement=true \
--kubeconfig "$KUBECONFIG"
--kubeconfig "$KUBECONFIG" \
--verbose
) &

# Save the PID of the process
Expand Down
20 changes: 18 additions & 2 deletions tools/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/bash

# Enable job control
set -m
set -e

# Set traps to handle errors
trap 'handle_error' ERR
Expand Down Expand Up @@ -93,10 +93,12 @@ echo "All the tools are installed."
# Check if the input is 1, 2 or 3
if [ "$environment_type" -eq 1 ]; then
environment_type="customkind"
kubernetes_clusters="kind"
# Call create_kind clusters with parameters and save return value into clusters variable
create_kind_clusters "$consumers_json" "$providers_json" $environment_type 1 1
elif [ "$environment_type" -eq 2 ]; then
environment_type="customkind"
kubernetes_clusters="kind"
# Ask the user how many consumer and provider clusters they want
read -r -p "How many consumer clusters do you want? " consumer_clusters
read -r -p "How many provider clusters do you want? " provider_clusters
Expand All @@ -110,14 +112,28 @@ elif [ "$environment_type" -eq 2 ]; then
# Call create_kind clusters with parameters and save return value into clusters variable
create_kind_clusters "$consumers_json" "$providers_json" $environment_type "$consumer_clusters" "$provider_clusters"
elif [ "$environment_type" -eq 3 ]; then
# Ask the user what Kubernetes clusters they want to use between kubeadm and k3s
read -r -p "What type of Kubernetes clusters do you want to use? /
1. kubeadm /
2. k3s /
Please enter the number of the option you want to use:
" kubernetes_clusters
if [ "$kubernetes_clusters" -eq 1 ]; then
kubernetes_clusters="kubeadm"
elif [ "$kubernetes_clusters" -eq 2 ]; then
kubernetes_clusters="k3s"
else
echo "Invalid option."
return 1
fi
get_clusters "$consumers_json" "$providers_json"
else
echo "Invalid option."
return 1
fi

# FLUIDOS node installation
install_components "$consumers_json" "$providers_json" $local_repositories $local_resource_manager
install_components "$consumers_json" "$providers_json" $local_repositories $local_resource_manager $kubernetes_clusters

print_title "Installation completed successfully"

Expand Down

0 comments on commit 6b64841

Please sign in to comment.