Created
June 12, 2024 19:03
-
-
Save nickboldt/ac08afa063af5424e419867f292543b1 to your computer and use it in GitHub Desktop.
log in to cluster and authorize pulling containers from quay and RHEC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# secrets | |
QUAY_TOKEN="you-bot-token-here" | |
RRIO_USERNAME="your-bot-here" | |
RRIO_PASSWORD="your-bot-pwd-here | |
# login to quay.io | |
REGISTRY="quay.io" | |
QUAY_USER="your-bot-user-here" | |
echo -n "[INFO]: Log into $REGISTRY ... " | |
echo "${QUAY_TOKEN}" | skopeo login -u="${QUAY_USER}" --password-stdin ${REGISTRY} | |
# echo "export QUAY_TOKEN=\"${QUAY_TOKEN}\""; echo | |
# login to registry.redhat.io | |
REGISTRY="registry.redhat.io" | |
echo -n "[INFO]: Log into $REGISTRY ... " | |
echo "${RRIO_PASSWORD}" | skopeo login -u="${RRIO_USERNAME}" --password-stdin ${REGISTRY} | |
echo; echo "[INFO]: Add registry logins to OCP ... " | |
# get global secret and update it for your registry logins | |
oc get secret/pull-secret -n openshift-config --template='{{index .data ".dockerconfigjson" | base64decode}}' >/tmp/oc_secret | |
oc registry login --registry="quay.io" --auth-basic="$QUAY_USER:$QUAY_TOKEN" --to=/tmp/oc_secret | |
oc registry login --registry="registry.redhat.io" --auth-basic="$RRIO_USERNAME:$RRIO_PASSWORD" --to=/tmp/oc_secret | |
oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=/tmp/oc_secret | |
echo "[INFO] Creating projects for helm or operator install... " | |
oc new-project rhdh-helm | |
oc new-project rhdh-operator | |
kubectl -n rhdh-operator create secret docker-registry rhdh-pull-secret --from-file=.dockerconfigjson=/tmp/oc_secret | |
kubectl -n rhdh-helm create secret docker-registry rhdh-pull-secret --from-file=.dockerconfigjson=/tmp/oc_secret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment