Skip to content

Commit

Permalink
Testing Arm Platform - cli tools
Browse files Browse the repository at this point in the history
  • Loading branch information
gpillon committed Oct 21, 2024
1 parent 974b77f commit 5f4e872
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
24 changes: 24 additions & 0 deletions scripts/k4all-utils
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,27 @@ mask_to_cidr() {

echo $c ;
}

# Function to get the system's architecture
get_architecture() {
uname -m
}

# Function to set CLI_ARCH based on the detected architecture
set_cli_arch() {
local ARCH=$(get_architecture)
case "${ARCH}" in
x86_64)
CLI_ARCH="amd64"
;;
armv7l | armv8* | aarch64)
CLI_ARCH="arm64"
;;
*)
echo "Unsupported architecture: ${ARCH}"
exit 1
;;
esac
echo "CLI_ARCH is set to: ${CLI_ARCH}"
export CLI_ARCH
}
2 changes: 1 addition & 1 deletion scripts/setup-cni-cilium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ source /usr/local/bin/k4all-utils

# Install cilium CLI
retry_command "CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)" 10 30
CLI_ARCH=amd64
set_cli_arch
if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
retry_command "curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}" 10 30
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
Expand Down
7 changes: 4 additions & 3 deletions scripts/setup-feature-virt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ retry_command "kubectl apply -f https://github.com/kubevirt/kubevirt/releases/do
kubectl -n kubevirt patch kubevirt kubevirt --type=merge --patch '{"spec":{"infra":{"replicas": 1 }}}'
kubectl -n kubevirt wait kubevirt kubevirt --for condition=Available --timeout=3600s

set_cli_arch
# Install virtctl
retry_command "curl -L https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/virtctl-${RELEASE}-linux-amd64 -o /usr/local/bin/virtctl-${RELEASE}-linux-amd64" 10 30
chmod +x /usr/local/bin/virtctl-${RELEASE}-linux-amd64
ln -sf /usr/local/bin/virtctl-${RELEASE}-linux-amd64 /usr/local/bin/virtctl
retry_command "curl -L https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/virtctl-${RELEASE}-linux-${CLI_ARCH} -o /usr/local/bin/virtctl-${RELEASE}-linux-${CLI_ARCH}" 10 30
chmod +x /usr/local/bin/virtctl-${RELEASE}-linux-${CLI_ARCH}
ln -sf /usr/local/bin/virtctl-${RELEASE}-linux-${CLI_ARCH} /usr/local/bin/virtctl
chmod +x /usr/local/bin/virtctl

virtctl completion bash > /etc/bash_completion.d/virtctl_bash_completion
Expand Down

0 comments on commit 5f4e872

Please sign in to comment.