Skip to content

Commit

Permalink
Small improvement in crc-cloud role
Browse files Browse the repository at this point in the history
Added improvements:
- the generated ssh pub key is also added to the authorized keys because
  of the machineconfig
- export the KUBECONFIG variable, due it was changed to the local
  variable [1], so the oc command were failing with exit code 1. More
  info [2].
- set realpath for log file

[1] crc-org/crc-cloud#189
[2] crc-org/crc-cloud#191

Change-Id: I8ef8cf2a7742cb396671ebcfa7b8d585730158f4
  • Loading branch information
danpawlik committed Jul 9, 2024
1 parent 555ddb1 commit 1140787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions roles/prepare-crc-cloud/tasks/pre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
dest: ~core/id_rsa.pub
remote_src: true

- name: Copy generated pub key to authorized keys
ansible.builtin.copy:
src: ~core/.ssh/id_rsa.pub
dest: ~core/.ssh/authorized_keys.d/generated
remote_src: true

- name: Inject pull secret into /var/lib/kubelet/config.json
become: true
ansible.builtin.copy:
Expand Down
8 changes: 3 additions & 5 deletions roles/prepare-crc-cloud/tasks/start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
#!/bin/bash
# Waiting for merge: https://github.com/crc-org/crc-cloud/pull/189
export LOG_PATH="~core/workdir/"
export LOG_PATH="$(realpath ~core/workdir)"
export LOG_FILE="$LOG_PATH/clustersetup-log"
export KUBECONFIG=/opt/kubeconfig
export PULL_SECRET="{{ crc_secret_pabrodri.openshift_pull_secret | b64encode }}"
export PASS_DEVELOPER="{{ developer_pass }}"
export PASS_KUBEADMIN="{{ kubeadmin_pass }}"
export PASS_REDHAT="{{ redhat_pass }}"
export IIP="{{ ansible_default_ipv4.address }}"
export EIP="{{ crc_hostname }}"
# Workaround for openshift-marketplace and openshift-console container pull error
# https://github.com/danpawlik/crc-cloud/commits/global-pull-secret/
export GLOBAL_SECURED_REGISTRIES=true
sudo -E bash ~core/workdir/crc-cloud/pkg/bundle/setup/clustersetup.sh > ~core/workdir/crc-cloud-log 2> ~core/workdir/crc-cloud-error-log
dest: ~core/workdir/start-crc-cloud.sh
mode: "0755"
Expand Down

0 comments on commit 1140787

Please sign in to comment.