Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to set global pull-secret secret #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions pkg/bundle/setup/clustersetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ PASS_DEVELOPER="${PASS_DEVELOPER:-"_PASS_DEVELOPER_"}"
PASS_KUBEADMIN="${PASS_KUBEADMIN:-"_PASS_KUBEADMIN_"}"
PASS_REDHAT="${PASS_REDHAT:-"_PASS_REDHAT_"}"
MAXIMUM_LOGIN_RETRY=500
GLOBAL_SECURED_REGISTRIES="${GLOBAL_SECURED_REGISTRIES:-"false"}"

pr_info() {
echo "[INF] $1" | tee -a $LOG_FILE > /dev/null
Expand Down Expand Up @@ -182,6 +183,15 @@ patch_pull_secret() {
sleep $STEPS_SLEEP_TIME
}

global_pull_secret() {
pr_info "adding pull-secret as global cluster pull secret"
oc get secret/pull-secret -n openshift-config --template='{{index .data ".dockerconfigjson" | base64decode}}' > /tmp/pull-secret.txt
oc create secret generic global-pull-secret --from-file=.dockerconfigjson=/tmp/pull-secret.txt --type=kubernetes.io/dockerconfigjson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stop_if_failed $? "failed to create global pull secret"
rm /tmp/pull-secret.txt
sleep $STEPS_SLEEP_TIME
}

create_certificate_and_patch_secret() {
pr_info "creating OpenShift secrets"
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout nip.key -out nip.crt -subj "/CN=$EIP.nip.io" -addext "subjectAltName=DNS:apps.$EIP.nip.io,DNS:*.apps.$EIP.nip.io,DNS:api.$EIP.nip.io"
Expand Down Expand Up @@ -262,6 +272,9 @@ stop_if_failed $? "failed to recover Cluster after $(expr $CLUSTER_HEALTH_RETRIE


patch_pull_secret
if [[ "$GLOBAL_SECURED_REGISTRIES" =~ True|true ]]; then
global_pull_secret
fi
wait_cluster_become_healthy "etcd|openshift-apiserver"
stop_if_failed $? "failed to recover Cluster after $(expr $CLUSTER_HEALTH_RETRIES \* $CLUSTER_HEALTH_SLEEP) seconds"

Expand Down