SpectroCloud/AirGapEdgeISO: Difference between revisions

From DER's LLC
Jump to navigation Jump to search
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Air-Gapped Edge ISO =
= Air-Gapped Edge ISO =
https://ders-gitlab.dersllc.com/ders/spectro-sa/-/wikis/Airgapped-Edge-All-In-One-ISO
== Prerequisites==
== Prerequisites==
=== DER's Lab Specific ===
=== DER's Lab Specific ===
Line 50: Line 51:
  # CLUSTERCONFIG=test-edge-iso-profile-cluster-definition.tgz
  # CLUSTERCONFIG=test-edge-iso-profile-cluster-definition.tgz
  # CIS_HARDENING=true
  # CIS_HARDENING=true
# BASE_IMAGE=quay.io/kairos/ubuntu:24.04-core-amd64-generic-v3.0.14


  # CHANGE THE FOLLOWING IN THE K8S LAYER
  # CHANGE THE FOLLOWING IN THE K8S LAYER
Line 60: Line 62:
  ######################
  ######################
  export OS=ubuntu-fips;                                                          #rhel, rhel-fips, ubuntu, ubuntu-fips
  export OS=ubuntu-fips;                                                          #rhel, rhel-fips, ubuntu, ubuntu-fips
  export PALETTE_ENDPOINT="vertex.dersllc.com";
  export PALETTE_ENDPOINT="paas.dersllc.com";
  export API_KEY='Njk1OWU2Mzk5YTNmZmY4MjMxMmEwYmE0N2VjMTRkZmM=';
  export API_KEY='Y2ZiYWZkNWRmN2E0YjAzYTFjYjYyOTBhMjk3YjZlMDg=';
  export CLUSTER_PROFILE_NAME="test-edge-iso-$OS"
  export CLUSTER_PROFILE_NAME="test-edge-iso-$OS"
  export PROFILE_NAME="Default";
  export CLUSTER_PROFILE_VERSION=1.0.2
  export EDGE_CLI_VERSION="v4.6.3";                                            #https://docs.spectrocloud.com/component/#palette-edge-cli-versions
export PROJECT_NAME="all-in-one-iso";
  export EDGE_CLI_VERSION="v4.6.9";                                            #https://docs.spectrocloud.com/component/#palette-edge-cli-versions
   
   
  #################################
  #################################
Line 72: Line 75:
  chmod +x palette-edge
  chmod +x palette-edge
  mv palette-edge /usr/local/bin
  mv palette-edge /usr/local/bin
cd ~; rm -rf CanvOS
   
   
  ###################################
  ###################################
Line 78: Line 82:
  git clone https://github.com/spectrocloud/CanvOS.git
  git clone https://github.com/spectrocloud/CanvOS.git
  cd CanvOS
  cd CanvOS
  #                   export EDGE_CLI_VERSION=`git tag | sort --version-sort | tail -1`
  #export EDGE_CLI_VERSION=`git tag | sort --version-sort | tail -1`
  git checkout $EDGE_CLI_VERSION  
  git checkout $EDGE_CLI_VERSION  
   
   
Line 91: Line 95:
  # Get the Project and Cluster Profile IDs and K8S Version from the VERTEX API #
  # 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=="'${PROJECT_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 CLUSTER_PROFILE_UID=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY -H 'Projectuid: '${PROJECT_UID} -H "Content-Type: application/json" | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq '.spec | select(.version=="'${CLUSTER_PROFILE_VERSION}'")' | jq -r .published.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`
  export K8S_VERSION=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY -H 'Projectuid: '${PROJECT_UID} -H "Content-Type: application/json" | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq '.spec | select(.version=="'${CLUSTER_PROFILE_VERSION}'")' | jq -r .published.packs[1].version`
  #echo $CLUSTER_PROFILE_UID; echo $PROJECT_UID; echo $K8S_VERSION;
  #echo PROJECT_UID:$PROJECT_UID; echo CLUSTER_PROFILE_ID:$CLUSTER_PROFILE_UID; echo K8S_VERSION:$K8S_VERSION;
   
   
  #####################################
  #####################################
Line 109: Line 114:
  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.
  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
  #cat k8s_version.json
#########################################
# Customize the Local-Ui (Not-Required) #
#########################################
mkdir -p local-ui/ui
mkdir -p local-ui/app
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/customizations.json > local-ui/ui/customizations.json
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/index.html > local-ui/app/index.html
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/154x65.png > local-ui/ui/154x65.png
tar cvf local-ui.tar local-ui
   
   
  #############################
  #############################
  # Build the Provider Images #
  # Build the Provider Images #
  #############################
  #############################
  sudo ./earthly.sh +build-provider-images  
# Pull the earthly image and retag so it does not re-pull everytime!
docker pull us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:v0.8.15
docker tag us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:v0.8.15 us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:keep
#sudo ./earthly.sh +build-provider-images
  sudo ./earthly.sh +build-provider-images-fips


  #############################################
  #############################################
Line 131: Line 150:
  --cluster-definition-name $CLUSTER_PROFILE_NAME-cluster-definition \
  --cluster-definition-name $CLUSTER_PROFILE_NAME-cluster-definition \
  --cluster-definition-profile-ids $CLUSTER_PROFILE_UID  
  --cluster-definition-profile-ids $CLUSTER_PROFILE_UID  
 
  ############################
  ############################
  # Build the All-In-One ISO #
  # Build the All-In-One ISO #
Line 142: Line 161:
  touch ~/CanvOS/build/$ISO_NAME.iso
  touch ~/CanvOS/build/$ISO_NAME.iso
  mv ~/CanvOS/build/$ISO_NAME.iso /nfs/0-ISOs/
  mv ~/CanvOS/build/$ISO_NAME.iso /nfs/0-ISOs/
== References ==
=== Building Provider Images ===
https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-provider-images/
=== Build Content Bundle ===
https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-content-bundle/
=== Create Installer ISO ===
https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-installer-iso/
=== Local-UI Custom Branding ===
https://docs.spectrocloud.com/clusters/edge/local-ui/host-management/theming/
=== Local-UI Custom Links ===
https://docs.spectrocloud.com/clusters/edge/local-ui/host-management/custom-link/

Latest revision as of 12:55, 18 April 2025

Air-Gapped Edge ISO

https://ders-gitlab.dersllc.com/ders/spectro-sa/-/wikis/Airgapped-Edge-All-In-One-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
# BASE_IMAGE=quay.io/kairos/ubuntu:24.04-core-amd64-generic-v3.0.14
# 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="paas.dersllc.com";
export API_KEY='Y2ZiYWZkNWRmN2E0YjAzYTFjYjYyOTBhMjk3YjZlMDg=';
export CLUSTER_PROFILE_NAME="test-edge-iso-$OS"
export CLUSTER_PROFILE_VERSION=1.0.2
export PROJECT_NAME="all-in-one-iso";
export EDGE_CLI_VERSION="v4.6.9";                                             #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 PROJECT_UID=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/projects' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY | jq '.items[] | select(.metadata.name=="'${PROJECT_NAME}'")' | jq -r .metadata.uid`
export CLUSTER_PROFILE_UID=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY -H 'Projectuid: '${PROJECT_UID} -H "Content-Type: application/json" | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq '.spec | select(.version=="'${CLUSTER_PROFILE_VERSION}'")' | jq -r .published.uid`
export K8S_VERSION=`curl -L 'https://'${PALETTE_ENDPOINT}'/v1/clusterprofiles' -H 'Accept: application/json' -H 'ApiKey: '$API_KEY -H 'Projectuid: '${PROJECT_UID} -H "Content-Type: application/json" | jq '.items[] | select(.metadata.name=="'${CLUSTER_PROFILE_NAME}'")' | jq '.spec | select(.version=="'${CLUSTER_PROFILE_VERSION}'")' | jq -r .published.packs[1].version`

#echo PROJECT_UID:$PROJECT_UID; echo CLUSTER_PROFILE_ID:$CLUSTER_PROFILE_UID; echo K8S_VERSION:$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

#########################################
# Customize the Local-Ui (Not-Required) #
#########################################
mkdir -p local-ui/ui
mkdir -p local-ui/app
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/customizations.json > local-ui/ui/customizations.json
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/index.html > local-ui/app/index.html
curl https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/airgapped-edge/customizations/154x65.png > local-ui/ui/154x65.png
tar cvf local-ui.tar local-ui

#############################
# Build the Provider Images #
#############################
# Pull the earthly image and retag so it does not re-pull everytime!
docker pull us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:v0.8.15
docker tag us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:v0.8.15 us-docker.pkg.dev/palette-images/third-party/edge/earthly/earthly:keep
#sudo ./earthly.sh +build-provider-images 
sudo ./earthly.sh +build-provider-images-fips 
#############################################
# 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/

References

Building Provider Images

https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-provider-images/

Build Content Bundle

https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-content-bundle/

Create Installer ISO

https://docs.spectrocloud.com/clusters/edge/edgeforge-workflow/palette-canvos/build-installer-iso/

Local-UI Custom Branding

https://docs.spectrocloud.com/clusters/edge/local-ui/host-management/theming/

Local-UI Custom Links

https://docs.spectrocloud.com/clusters/edge/local-ui/host-management/custom-link/