Skip to content
Merged
Show file tree
Hide file tree
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
60 changes: 0 additions & 60 deletions 99_master-create-users-symlink.yaml

This file was deleted.

39 changes: 35 additions & 4 deletions snc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ cp cluster-network-03-config.yaml ${INSTALL_DIR}/manifests/
cp 99_master-chronyd-mask.yaml $INSTALL_DIR/openshift/
# Add dummy network unit file
cp 99-openshift-machineconfig-master-dummy-networks.yaml $INSTALL_DIR/openshift/
# Add unit file for creating /Users and symlink it to /var/Users
# It is used for mounting shared directory on Mac
# https://github.com/coreos/rpm-ostree/issues/337
cp 99_master-create-users-symlink.yaml $INSTALL_DIR/openshift/
# Add kubelet config resource to make change in kubelet
DYNAMIC_DATA=$(base64 -w0 node-sizing-enabled.env) envsubst < 99_master-node-sizing-enabled-env.yaml.in > $INSTALL_DIR/openshift/99_master-node-sizing-enabled-env.yaml
# Add codeReadyContainer as invoker to identify it with telemeter
Expand Down Expand Up @@ -245,6 +241,39 @@ retry ${OC} delete mc chronyd-mask
# Wait for the cluster again to become stable because of all the patches/changes
wait_till_cluster_stable

# This section is used to create a custom-os image which have `/Users`
Copy link
Contributor

Choose a reason for hiding this comment

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

imo this comment is a strong indication that this belongs in a create_custom_os_image helper function.

# For more details check https://github.com/crc-org/snc/issues/1041#issuecomment-2785928976
# This should be performed before removing pull secret
# Unsetting KUBECONFIG is required because it has default `system:admin` user which doesn't able to create
# token to login to registry and kubeadmin user is required for that.
unset KUBECONFIG
RHCOS_IMAGE=$(${OC} adm release info -a ${OPENSHIFT_PULL_SECRET_PATH} ${OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE} --image-for=rhel-coreos)
cat << EOF > ${INSTALL_DIR}/Containerfile
FROM scratch
Copy link
Contributor

Choose a reason for hiding this comment

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

you could use ${RHCOS_IMAGE} here, and remove the --from ${RHCOS_IMAGE} arg from podman build.
The shell should be able to expand it to its value.

RUN ln -sf var/Users /Users && mkdir /var/Users
EOF
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 .
retry ${OC} login -u kubeadmin -p $(cat ${INSTALL_DIR}/auth/kubeadmin-password) --insecure-skip-tls-verify=true api.${SNC_PRODUCT_NAME}.${BASE_DOMAIN}:6443
retry ${OC} registry login -a ${INSTALL_DIR}/reg.json
podman push --authfile ${INSTALL_DIR}/reg.json --tls-verify=false default-route-openshift-image-registry.apps-crc.testing/openshift-machine-config-operator/rhcos:latest
cat << EOF > ${INSTALL_DIR}/custom-os-mc.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: custom-image
spec:
osImageURL: image-registry.openshift-image-registry.svc:5000/openshift-machine-config-operator/rhcos:latest
Copy link
Member

Choose a reason for hiding this comment

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

how much does the it increase the bundle size? and can we later delete the image after machine config pool is updated?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that's what I am exploring.

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked the images if it is stored in bundle after creating the bundle

rhel-coreos                                    sha256:66b5f9d8f1af5acee783db84a25c08338252ff9c276d33e391680168a22f42ee

but it is not available in the bundle.

EOF
retry ${OC} apply -f ${INSTALL_DIR}/custom-os-mc.yaml
sleep 60
# Wait till machine config pool is updated correctly
while retry ${OC} get mcp master -ojsonpath='{.status.conditions[?(@.type!="Updated")].status}' | grep True; do
echo "Machine config still in updating/degrading state"
done

export KUBECONFIG=${INSTALL_DIR}/auth/kubeconfig
mc_before_removing_pullsecret=$(retry ${OC} get mc --sort-by=.metadata.creationTimestamp --no-headers -oname)
# Replace pull secret with a null json string '{}'
retry ${OC} replace -f pull-secret.yaml
Expand Down Expand Up @@ -277,3 +306,5 @@ ${SSH} core@api.${SNC_PRODUCT_NAME}.${BASE_DOMAIN} -- 'sudo crictl rmi --prune'

# Remove the baremetal_runtimecfg container which is temp created
${SSH} core@api.${SNC_PRODUCT_NAME}.${BASE_DOMAIN} -- "sudo podman rm baremetal_runtimecfg"