Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.
Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-24 18:44:59 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-08-13 10:01:35 -05:00
|
|
|
# This script is for kubernetes master image usage
|
|
|
|
# Will mount kubernetes master disk and execute kubernetes entrance script
|
Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.
Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-24 18:44:59 -05:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2023-09-01 00:26:24 -05:00
|
|
|
# Mount disk from host
|
Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.
Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-24 18:44:59 -05:00
|
|
|
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
|
|
|
|
|
2023-09-08 01:22:47 -05:00
|
|
|
# Check whether it is the first time to boot
|
Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.
Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-24 18:44:59 -05:00
|
|
|
first_boot_flag_file="/from_host/first_boot_flag"
|
|
|
|
if [ -f $first_boot_flag_file ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
touch $first_boot_flag_file
|
|
|
|
|
2023-09-30 03:16:51 -05:00
|
|
|
# Execute entrance script
|
Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.
Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-24 18:44:59 -05:00
|
|
|
init_file_name="entrance.sh"
|
|
|
|
init_file=${mount_point}/${init_file_name}
|
|
|
|
chmod +x $init_file
|
|
|
|
source $init_file
|