SpectroCloud/AirGapEdgeISO: Difference between revisions

From DER's LLC
Jump to navigation Jump to search
Line 56: Line 56:


== Build the All-In-One ISO File ==
== Build the All-In-One ISO File ==
cd ~
rm -rf CanvOS
  ######################
  ######################
  # REQUIRED VARIABLES #
  # REQUIRED VARIABLES #
Line 75: Line 72:
  chmod +x palette-edge
  chmod +x palette-edge
  mv palette-edge /usr/local/bin
  mv palette-edge /usr/local/bin
cd ~; rm -rf CanvOS
   
   
  ###################################
  ###################################

Revision as of 14:44, 11 March 2025

Air-Gapped Edge ISO

Prerequisites

DER's Lab Specific

#######################################
# Build the ISO on the JUMPBOX Server #
#######################################
ssh [email protected]
sudo su - 
##############################
# Mount the VMware Datastore #
##############################
echo "172.16.84.7:/data/hdd/0-ISOs    /nfs/0-ISOs             nfs defaults    0 0" >> /etc/fstab
cat /etc/fstab
mkdir -p /nfs/0-ISOs
systemctl daemon-reload
mount -a

ISO Build Requirements

##############################################
# Create Harbor Repo for the provider images #
##############################################
# Name: airgap-edge
# Type: public
#################################################################
# Update the .args file and BYOI Layer with the Following Info: #
#################################################################
# BYOI VALUES:
options:
  system.uri: "{{ .spectro.pack.edge-native-byoi.options.system.registry }}/{{ .spectro.pack.edge-native-byoi.options.system.repo }}:{{ .spectro.pack.edge-native-byoi.options.system.k8sDistribution }}-{{.spectro.system.kubernetes.version }}-{{ .spectro.pack.edge-native-byoi.options.system.peVersion }}-{{ .spectro.pack.edge-native-byoi.options.system.customTag }}"
  system.registry: harbor.dersllc.com/airgap-edge
  system.repo: ubuntu
  system.k8sDistribution: kubeadm
  system.osName: ubuntu
  system.peVersion: v4.6.3
  system.customTag: ders-edge
  system.osVersion: 22.04
#
# .ARG FILE:
# CUSTOM_TAG=ders-edge
# IMAGE_REGISTRY=harbor.dersllc.com/airgap-edge
# OS_DISTRIBUTION=ubuntu
# IMAGE_REPO=$OS_DISTRIBUTION
# OS_VERSION=22.04
# K8S_DISTRIBUTION=kubeadm
# ISO_NAME=ders-edge-installer
# ARCH=amd64
# UPDATE_KERNEL=false
# CLUSTERCONFIG=test-edge-iso-profile-cluster-definition.tgz
# CIS_HARDENING=true
# CHANGE THE FOLLOWING IN THE K8S LAYER
# REMOVE: AlwaysPullImages
# MAKE SURE YOU HAVE THE HARBOR-EDGE-NATIVE-CONFIG LAYER ADDED TO THE PROFILE

Build the All-In-One ISO File

######################
# REQUIRED VARIABLES #
######################
export OS=ubuntu-fips;                                                          #rhel, rhel-fips, ubuntu, ubuntu-fips
export PALETTE_ENDPOINT="vertex.dersllc.com";
export API_KEY='Njk1OWU2Mzk5YTNmZmY4MjMxMmEwYmE0N2VjMTRkZmM=';
export CLUSTER_PROFILE_NAME="test-edge-iso-$OS"
export PROFILE_NAME="Default";
export EDGE_CLI_VERSION="v4.6.3";                                             #https://docs.spectrocloud.com/component/#palette-edge-cli-versions

#################################
# Download the Palette-Edge CLI #
#################################
wget https://software.spectrocloud.com/stylus/$EDGE_CLI_VERSION/cli/linux/palette-edge
chmod +x palette-edge
mv palette-edge /usr/local/bin
cd ~; rm -rf CanvOS

###################################
# Use GIT to pull the CanvOS Repo #
###################################
git clone https://github.com/spectrocloud/CanvOS.git
cd CanvOS
#                   export EDGE_CLI_VERSION=`git tag | sort --version-sort | tail -1`
git checkout $EDGE_CLI_VERSION 

################################################
# Pull the .arg and user-data file from gitlab #
################################################
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/.arg-$OS.yaml > .arg
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/user-data-$OS.yaml > user-data
#sudo ./earthly.sh +validate-user-data 

###############################################################################
# Get the Project and Cluster Profile IDs and K8S Version from the VERTEX API #
###############################################################################
export CLUSTER_PROFILE_UID=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq -r .metadata.uid`
export PROJECT_UID=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/projects' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY | jq '.items[] | select(.metadata.name=="'${PROFILE_NAME}'")' | jq -r .metadata.uid`
export K8S_VERSION=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq -r .spec.published.packs[1].tag`
#echo $CLUSTER_PROFILE_UID; echo $PROJECT_UID; echo $K8S_VERSION;

#####################################
# Pull Variables from the .arg File #
#####################################
export CUSTOM_TAG=`cat .arg | grep CUSTOM_TAG | cut -d "=" -f 2`
export IMAGE_REGISTRY=`cat .arg | grep IMAGE_REGISTRY | cut -d "=" -f 2`
export OS_DISTRIBUTION=`cat .arg | grep OS_DISTRIBUTION | cut -d "=" -f 2`
export OS_VERSION=`cat .arg | grep OS_VERSION | cut -d "=" -f 2`
export K8S_DISTRIBUTION=`cat .arg | grep K8S_DISTRIBUTION | cut -d "=" -f 2`
export ISO_NAME=`cat .arg | grep ISO_NAME | cut -d "=" -f 2`
#echo $CUSTOM_TAG; echo $IMAGE_REGISTRY; echo $OS_DISTRIBUTION; echo $OS_VERSION; echo $K8S_DISTRIBUTION; echo $ISO_NAME

echo '{"'$K8S_DISTRIBUTION'":["'$K8S_VERSION'"]}' | jq > k8s_version.json; # Set only the version you need in the k8s_version.json. This needs to match the version in your profile.
#cat k8s_version.json

#############################
# Build the Provider Images #
#############################
sudo ./earthly.sh +build-provider-images 
#############################################
# Push the Provider image to the Image Repo #
#############################################
docker push $IMAGE_REGISTRY/$OS_DISTRIBUTION:$K8S_DISTRIBUTION-$K8S_VERSION-$EDGE_CLI_VERSION-$CUSTOM_TAG 

###########################################################
# Export the Vertex Profile Definition and Content Bundle #
########################################################### 
palette-edge build --api-key $API_KEY \
--project-id $PROJECT_UID \
--cluster-profile-ids $CLUSTER_PROFILE_UID \
--palette-endpoint $PALETTE_ENDPOINT \
--outfile $CLUSTER_PROFILE_NAME-content-bundle \
--include-palette-content \
--cluster-definition-name $CLUSTER_PROFILE_NAME-cluster-definition \
--cluster-definition-profile-ids $CLUSTER_PROFILE_UID 

############################
# Build the All-In-One ISO #
############################
sudo ./earthly.sh +iso

#######################################
# Move the ISO to my VMware Datastore #
#######################################
touch ~/CanvOS/build/$ISO_NAME.iso
mv ~/CanvOS/build/$ISO_NAME.iso /nfs/0-ISOs/