Skip to content

Commit

Permalink
Add default console passsword for VMs in CI
Browse files Browse the repository at this point in the history
Signed-off-by: David Vossel <davidvossel@gmail.com>
  • Loading branch information
davidvossel committed May 7, 2024
1 parent 81afa42 commit 0cab64c
Showing 1 changed file with 33 additions and 2 deletions.
Expand Up @@ -89,7 +89,6 @@ fi
oc patch ingresscontroller -n openshift-ingress-operator default --type=json -p \
'[{ "op": "add", "path": "/spec/routeAdmission", "value": {wildcardPolicy: "WildcardsAllowed"}}]'


RELEASE_IMAGE="${RELEASE_IMAGE_LATEST}"

if [[ "${DISCONNECTED}" == "true" ]];
Expand Down Expand Up @@ -130,7 +129,6 @@ then

fi


echo "$(date) Creating HyperShift guest cluster ${CLUSTER_NAME}"
# shellcheck disable=SC2086
"${HCP_CLI}" create cluster kubevirt ${EXTRA_ARGS} ${ICSP_COMMAND} \
Expand All @@ -144,6 +142,39 @@ echo "$(date) Creating HyperShift guest cluster ${CLUSTER_NAME}"
--pull-secret "${PULL_SECRET_PATH}" \
--generate-ssh

# Set Console Password for NodePool VMs so we can easily debug them even if network failures occur
oc apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: set-core-user-password
namespace: clusters
data:
config: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: set-core-user-password
spec:
config:
ignition:
version: 3.2.0
passwd:
users:
- name: core
# password is core
passwordHash: \$6\$jzPb4LOXbVSL5ZA.\$uvohJQPV7yej8aJ6aD.nmJifBTuQVpy5KyQkmIOt6YVdQhC2O2CXJE1TVKeRm.ie6VVVa9YZqIUToROr7qDmX0
EOF

cat << EOF > mc-patch.yaml
spec:
config:
- name: set-core-user-password
EOF
oc patch nodepool -n clusters $CLUSTER_NAME --patch-file mc-patch.yaml

if [[ -n ${MCE} ]] ; then
if (( $(awk 'BEGIN {print ("'"$MCE_VERSION"'" < 2.4)}') )); then
oc annotate hostedclusters -n "${CLUSTER_NAMESPACE_PREFIX}" "${CLUSTER_NAME}" "cluster.open-cluster-management.io/managedcluster-name=${CLUSTER_NAME}" --overwrite
Expand Down

0 comments on commit 0cab64c

Please sign in to comment.