sonic-buildimage/files/image_config/kubernetes/kubernetes_master_entrance.sh
lixiaoyuner 410e6ff406
Install pyOpenSSL package for k8s master (#16361)
### Why I did it
Need a tool to check certificate's detail of information.
##### Work item tracking
- Microsoft ADO **(number only)**: 25020260
#### How I did it
Install pyOpenSSL package for k8s master
#### How to verify it
Pip3 list to check whether it's installed when include_kubernetes_master=y
2023-08-31 22:26:24 -07:00

48 lines
1.3 KiB
Bash

#!/bin/bash
# This script is for kubernetes master image usage
# Will mount kubernetes master disk and execute kubernetes entrance script
set -x
# Mount disk from host
mount_point="/from_host"
disk_by_path_dir="/dev/disk/by-path"
# We can't ensure the mounted disk name is sda or sdb
# Currently we specify the disk logic unit number to 2 when create master VM
# We find the correct disk by the disk logic unit number from by-path directory
target_str="lun-2-part1"
disk_path_file=$(ls $disk_by_path_dir | grep $target_str)
# Check whether the disk path file exists
if [ -z "$disk_path_file" ]; then
echo "Error: Disk path file not found."
exit 1
fi
# Check the number of lines returned
line_count=$(echo "$disk_path_file" | wc -l)
# If there are multiple lines, exit with status 1
if [ "$line_count" -ne 1 ]; then
echo "Error: multiple disk path files found."
exit 1
fi
disk="${disk_by_path_dir}/${disk_path_file}"
mkdir -p $mount_point
mount $disk $mount_point
# check whether it is the first time to boot
first_boot_flag_file="/from_host/first_boot_flag"
if [ -f $first_boot_flag_file ]; then
exit 0
fi
touch $first_boot_flag_file
# execute entrance script
init_file_name="entrance.sh"
init_file=${mount_point}/${init_file_name}
chmod +x $init_file
source $init_file