-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Edit -- TLDR summary of findings:
Zarf fails to populate it's container registry, when imported HTTPS certs are used that don't allow for 127.0.0.1 (so public internet CA signed ones won't work), but zarf's self generated HTTPS certs will work.
Summary:
So about the docs... I've messed with zarf several times, but have never been able to get anything beyond zarf init to work correctly. (which offers an empty git repo + empty registry)
(This is why I didn't realize that zarf can populates it's registry + git repo, when I talked over zoom with @jeff-mccoy)
I tried the game example doc (with and without slight modifications) and I get image pull backoff, which shows the registry never got populated.
Before I go into steps to reproduce the bug I think you'll find my desired use case valuable.
Background context info about my ultimate use case:
- I have a script to imperatively generate a declarative images.txt list of 20-100 images (depending on input parameters)
- I plan to write a script to convert images.txt to a config like that can declaratively populate a registry. Basically script + images.txt ---> imperatively generated declarative zarf.yaml
- Said script will look similar to this (was investigating rancher's hauler but it doesn't work with authenticated registries, but this will give you a concrete idea of where my thinking is at / how I plan to imperatively generate a declarative zarf.yaml)
export TEMPLATIZED_IMAGES_LIST=$(cat imperatively-generated-bb-images.txt | sed 's/^/ - ref: /' )
echo "$TEMPLATIZED_IMAGES_LIST"
cat > declarative-hauler-config.yaml <<EOF
apiVersion: content.hauler.cattle.io/v1alpha1
kind: Images
metadata:
name: bigbang-images
spec:
images:
$TEMPLATIZED_IMAGES_LIST
EOF
hauler store sync -f declarative-hauler-config.yaml- Side Note: Can you bump registry:2's default PVC size from 10GB to 100GB? (It'll help my use case + won't hurt anything since local-path storage is thin provisioned)
Copy Paste-able Reproducibility commands:
- I use vagrant to provision a fresh centos7 VM
# provisioned fresh rhel7 for this and ssh'd in
# install git
sudo yum install git -y
# become root / per zarf docs
# I'm assuming all commands need to be run as root
sudo su -
# install zarf 0.13.3 and zarf's dependencies artifact tar
cd ~
curl -L https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/v0.13.3/zarf > zarf-cli
chmod +x zarf-cli
sudo mv zarf-cli /usr/bin/zarf
curl -L https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/v0.13.3/zarf-init.tar.zst > zarf-init.tar.zst #538mb
# Install yq
export VERSION=v4.14.1
export BINARY=yq_linux_amd64
sudo wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
# install jq
sudo yum install jq -y
# verify yq / jq installed correctly
yq --version
jq --version
# pull dev cert/key pair for *.bigbang.dev
curl -L https://repo1.dso.mil/platform-one/big-bang/bigbang/-/raw/master/chart/ingress-certs.yaml | yq eval '.istio.gateways.public.tls.cert' - > bigbang.dev.crt
curl -L https://repo1.dso.mil/platform-one/big-bang/bigbang/-/raw/master/chart/ingress-certs.yaml | yq eval '.istio.gateways.public.tls.key' - > bigbang.dev.key
# Install zarf 0.13.3 & grab the zarf-init bootstrap artifact
cd ~
curl -L https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/v0.13.3/zarf > zarf-cli
chmod +x zarf-cli
sudo mv zarf-cli /usr/bin/zarf
curl -L https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/v0.13.3/zarf-init.tar.zst > zarf-init.tar.zst #538mb, takes about 1m20sec
# Pre-Login to registry1.dso.mil per zarf docs
export REGISTRY1_USERNAME=REPLACE_ME
export REGISTRY1_PASSWORD=REPLACE_ME
zarf tools registry login registry1.dso.mil -u $REGISTRY1_USERNAME -p $REGISTRY1_PASSWORD
# Lets you login w/o dependency on docker being installed, nice
# init zarf
cd ~
zarf init --server-key=$HOME/bigbang.dev.key --server-crt=$HOME/bigbang.dev.crt --host=bigbang.dev --components=management,gitops-service --confirm
# ^-- takes about 20 secs
kubectl get pod -A # zarf installs kubectl, just do this until it looks running
# Let's verify zarfs registry is empty b4 proceeding
# / Test Driven Development / helps to see what before and after look like
echo "127.0.0.1 registry.bigbang.dev" | tee -a /etc/hosts
export DOCKER_USER=$(sudo cat /root/.docker/config.json | jq '.auths."127.0.0.1".auth' | tr -d '"' | base64 -d | cut -d ':' -f 1)
export DOCKER_PASS=$(sudo cat /root/.docker/config.json | jq '.auths."127.0.0.1".auth' | tr -d '"' | base64 -d | cut -d ':' -f 2)
zarf tools registry login registry.bigbang.dev -u $DOCKER_USER -p $DOCKER_PASS
zarf tools registry catalog registry.bigbang.dev
# (shows zarf cli splash, but under zarf is blank --implies--> empty registry)
# Zarf deploy the Game Example
cd ~
git clone https://github.com/defenseunicorns/zarf.git
cd ~/zarf/examples/game
zarf package create --confirm
# ^-- 8 seconds
zarf package deploy zarf-package-appliance-demo-doom.tar.zst --confirm
# INFO[0000] Deploy Zarf package confirmed
# INFO[0000] Loading dynamic config path=/tmp/zarf-768846375/zarf.yaml
# INFO[0000] Deploying Zarf component name=baseline
# INFO[0000] Loading images for local install
# INFO[0000] Loading images for gitops service transfer
# INFO[0000] Loading images
# INFO[0000] Updating image image="registry.dso.mil/platform-one/big-bang/apps/product-tools/zarf/game:doom"
# INFO[0000] 127.0.0.1/platform-one/big-bang/apps/product-tools/zarf/game:doom
# WARN[0000] Unable to push the image to the registry image="registry.dso.mil/platform-one/big-bang/apps/product-tools/zarf/game:doom"
# INFO[0000] Loading manifests for local install, this may take a minute or so to reflect in k3s
# INFO[0000] Processing manifest file path=/tmp/zarf-768846375/components/baseline/manifests/game.yaml
# INFO[0000] Processing manifest file path=/tmp/zarf-768846375/components/baseline/manifests/image-pull-secret.yaml
# INFO[0000] Copying file Destination=/var/lib/rancher/k3s/server/manifests Source=/tmp/zarf-768846375/components/baseline/manifests
# INFO[0000] Cleaning up temp files
########################################
# The WARN mentions an Error
# The Error is that it tried to push to registry.dso.mil (repo1's registry built into gitlab)
# Why is zarf trying to do that? Bug? or config error?
# zarf's registry is still blank
zarf tools registry catalog registry.bigbang.dev
# (shows zarf cli splash, but under zarf is blank --implies--> empty registry)
kubectl get pod -A
# NAMESPACE NAME READY STATUS RESTARTS AGE
# default game-69f5486bff-xjl7x 0/1 ImagePullBackOff 0 4m31s```