@@ -241,6 +241,39 @@ retry ${OC} delete mc chronyd-mask
241
241
# Wait for the cluster again to become stable because of all the patches/changes
242
242
wait_till_cluster_stable
243
243
244
+ # This section is used to create a custom-os image which have `/Users`
245
+ # For more details check https://github.com/crc-org/snc/issues/1041#issuecomment-2785928976
246
+ # This should be performed before removing pull secret
247
+ # Unsetting KUBECONFIG is required because it has default `system:admin` user which doesn't able to create
248
+ # token to login to registry and kubeadmin user is required for that.
249
+ unset KUBECONFIG
250
+ RHCOS_IMAGE=$( ${OC} adm release info -a ${OPENSHIFT_PULL_SECRET_PATH} ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE} --image-for=rhel-coreos)
251
+ cat << EOF > ${INSTALL_DIR} /Containerfile
252
+ FROM scratch
253
+ RUN ln -sf var/Users /Users && mkdir /var/Users
254
+ EOF
255
+ podman build --from ${RHCOS_IMAGE} --authfile ${OPENSHIFT_PULL_SECRET_PATH} -t default-route-openshift-image-registry.apps-crc.testing/openshift-machine-config-operator/rhcos:latest --file ${INSTALL_DIR} /Containerfile .
256
+ retry ${OC} login -u kubeadmin -p $( cat ${INSTALL_DIR} /auth/kubeadmin-password) --insecure-skip-tls-verify=true api.${SNC_PRODUCT_NAME} .${BASE_DOMAIN} :6443
257
+ retry ${OC} registry login -a ${INSTALL_DIR} /reg.json
258
+ podman push --authfile ${INSTALL_DIR} /reg.json --tls-verify=false default-route-openshift-image-registry.apps-crc.testing/openshift-machine-config-operator/rhcos:latest
259
+ cat << EOF > ${INSTALL_DIR} /custom-os-mc.yaml
260
+ apiVersion: machineconfiguration.openshift.io/v1
261
+ kind: MachineConfig
262
+ metadata:
263
+ labels:
264
+ machineconfiguration.openshift.io/role: master
265
+ name: custom-image
266
+ spec:
267
+ osImageURL: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/rhcos:latest
268
+ EOF
269
+ retry ${OC} apply -f ${INSTALL_DIR} /custom-os-mc.yaml
270
+ sleep 60
271
+ # Wait till machine config pool is updated correctly
272
+ while retry ${OC} get mcp master -ojsonpath=' {.status.conditions[?(@.type!="Updated")].status}' | grep True; do
273
+ echo " Machine config still in updating/degrading state"
274
+ done
275
+
276
+ export KUBECONFIG=${INSTALL_DIR} /auth/kubeconfig
244
277
mc_before_removing_pullsecret=$( retry ${OC} get mc --sort-by=.metadata.creationTimestamp --no-headers -oname)
245
278
# Replace pull secret with a null json string '{}'
246
279
retry ${OC} replace -f pull-secret.yaml
@@ -273,3 +306,5 @@ ${SSH} core@api.${SNC_PRODUCT_NAME}.${BASE_DOMAIN} -- 'sudo crictl rmi --prune'
273
306
274
307
# Remove the baremetal_runtimecfg container which is temp created
275
308
${SSH} core@api.${SNC_PRODUCT_NAME} .${BASE_DOMAIN} -- " sudo podman rm baremetal_runtimecfg"
309
+
310
+
0 commit comments