Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions airgap-images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Airgap images

There are two types of airgap images:

- Rancher images

- EIB images for the mgmt-cluster

## Requirements

To retrieve the airgap images, you need to have the following tools installed:

- helm `curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash`

**IMPORTANT**: You need to run the following scripts in a cluster deployed with the final versions (the release you want to retrieve the airgap images list)


## Airgap images for the management cluster

The airgap images for the management cluster are located in the `airgap-images` directory. The images are used to create a management cluster that is not connected to the internet. The images are stored in a tar file and can be loaded into the local container registry using the following command:

```bash
./eib-mgmt-cluster-airgap-images.sh
```

This command will show you the full list images to be included in the EIB definition file for airgap scenarios


## Airgap images for rancher guide

```
./retrieve-rancher-airgap-images.sh
```

This will show you the list of images to be included in the rancher guide for airgap environments
4 changes: 4 additions & 0 deletions airgap-images/eib-mgmt-cluster-airgap-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq
71 changes: 71 additions & 0 deletions airgap-images/retrieve-airgap-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
set -euo pipefail

# CONFIGURATION ———
WORKDIR="./hauler_temp"
mkdir -p "${WORKDIR}"

# Add & update the Prime Helm repo
helm repo add rancher-prime https://charts.rancher.com/server-charts/prime
helm repo update

# Auto-detect Rancher version from your cluster (fallback to Helm)
if RANCHER_IMAGE=$(kubectl -n cattle-system get deployment rancher \
-o jsonpath='{.spec.template.spec.containers[0].image}' 2>/dev/null); then
RANCHER_VERSION="${RANCHER_IMAGE##*:}"
echo "Detected Rancher image in cluster: ${RANCHER_IMAGE}"
echo "Using Rancher version: ${RANCHER_VERSION}"
else
echo "Could not detect Rancher in cattle-system, falling back to Helm query"
RANCHER_VERSION=$(helm search repo rancher-prime/rancher \
| awk 'NR==2 {print $3}')
echo "Using Rancher GitHub release tag: ${RANCHER_VERSION}"
fi

# Download & fail if the tag doesn’t exist
PRIME_BASE="https://prime.ribs.rancher.io/rancher/${RANCHER_VERSION}"
curl -fSL "${PRIME_BASE}/rancher-images.txt" \
-o "${WORKDIR}/orig-rancher-images.txt" \
|| {
echo >&2 "ERROR: Rancher Prime release ${RANCHER_VERSION} not found at ${PRIME_BASE}"
exit 1
}

# Filter out unneeded images
sed -E '/neuvector|minio|gke|aks|eks|sriov|harvester|mirrored|longhorn|thanos|tekton|istio|hyper|jenkins|windows/d' \
"${WORKDIR}/orig-rancher-images.txt" \
> "${WORKDIR}/cleaned-rancher-images.txt"

# Re-add Cluster API and kubectl entries
grep cluster-api "${WORKDIR}/orig-rancher-images.txt" >> "${WORKDIR}/cleaned-rancher-images.txt"
grep kubectl "${WORKDIR}/orig-rancher-images.txt" >> "${WORKDIR}/cleaned-rancher-images.txt"

# ——— 5. Pick the latest tag for each repo ———
> "${WORKDIR}/rancher-unsorted.txt"
awk -F: '{print $1}' "${WORKDIR}/cleaned-rancher-images.txt" | sort -u |
while read -r repo; do
grep -w "$repo" "${WORKDIR}/cleaned-rancher-images.txt" \
| sort -Vr | head -1 \
>> "${WORKDIR}/rancher-unsorted.txt"
done

# Final sort & dedupe
sort -u "${WORKDIR}/rancher-unsorted.txt" > "${WORKDIR}/rancher-images.txt"

# Manual fix-ups
{
echo "rancher/kubectl:v1.20.2"
echo "rancher/shell:v0.1.24"
grep mirrored-ingress-nginx "${WORKDIR}/orig-rancher-images.txt"
} >> "${WORKDIR}/rancher-images.txt"

# Generate airgap_hauler.yaml
cat > airgap_hauler.yaml <<EOF
images:
EOF
while read -r img; do
echo " - name: ${img}"
done < "${WORKDIR}/rancher-images.txt" >> airgap_hauler.yaml

echo " • ${WORKDIR}/rancher-images.txt"
echo " • airgap_hauler.yaml"
Loading