@@ -15,36 +15,61 @@ INSTALL_DIR=${1:-crc-tmp-install-data}
15
15
16
16
# If the user set OKD_VERSION in the environment, then use it to set BASE_OS
17
17
OKD_VERSION=${OKD_VERSION:- none}
18
- destDirPrefix=" crc"
19
18
if [[ ${OKD_VERSION} != " none" ]]
20
19
then
21
20
BASE_OS=fedora-coreos
22
21
destDirPrefix=" crc_okd"
23
22
fi
24
23
BASE_OS=${BASE_OS:- rhcos}
25
24
OPENSHIFT_VERSION=$( ${JQ} -r .clusterInfo.openshiftVersion $INSTALL_DIR /crc-bundle-info.json)
25
+ BUNDLE_TYPE=$( ${JQ} -r .type $INSTALL_DIR /crc-bundle-info.json)
26
+ destDirPrefix=" crc"
27
+ if [ ${BUNDLE_TYPE} == " microshift" ]; then
28
+ destDirPrefix=" crc_${BUNDLE_TYPE} "
29
+ BASE_OS=rhel
30
+ fi
26
31
27
32
# SNC_PRODUCT_NAME: If user want to use other than default product name (crc)
28
33
# VM_PREFIX: short VM name (set by SNC_PRODUCT_NAME) + random string generated by openshift-installer
29
34
SNC_PRODUCT_NAME=${SNC_PRODUCT_NAME:- crc}
30
- VM_PREFIX=$( get_vm_prefix ${SNC_PRODUCT_NAME} )
31
- VM_NAME=" ${VM_PREFIX} -master-0"
35
+ if [ ${BUNDLE_TYPE} == " microshift" ]; then
36
+ VM_NAME=${SNC_PRODUCT_NAME}
37
+ else
38
+ VM_PREFIX=$( get_vm_prefix ${SNC_PRODUCT_NAME} )
39
+ VM_NAME=" ${VM_PREFIX} -master-0"
40
+ fi
32
41
33
- # Get the IP of the VM
34
42
VM_IP=$( sudo virsh domifaddr ${VM_NAME} | tail -2 | head -1 | awk ' {print $4}' | cut -d/ -f1)
35
43
36
- # Remove unused images from container storage
37
- ${SSH} core@${VM_IP} -- ' sudo crictl rmi --prune'
38
-
39
- # Disable kubelet service
40
- ${SSH} core@${VM_IP} -- sudo systemctl disable kubelet
41
-
42
- # Stop the kubelet service so it will not reprovision the pods
43
- ${SSH} core@${VM_IP} -- sudo systemctl stop kubelet
44
+ if [ ${BUNDLE_TYPE} != " microshift" ]; then
45
+ # Remove unused images from container storage
46
+ ${SSH} core@${VM_IP} -- ' sudo crictl rmi --prune'
47
+
48
+ # Disable kubelet service
49
+ ${SSH} core@${VM_IP} -- sudo systemctl disable kubelet
50
+
51
+ # Stop the kubelet service so it will not reprovision the pods
52
+ ${SSH} core@${VM_IP} -- sudo systemctl stop kubelet
53
+ fi
44
54
45
55
# Enable the podman.socket service for API V2
46
56
${SSH} core@${VM_IP} -- sudo systemctl enable podman.socket
47
57
58
+ if [ ${BUNDLE_TYPE} == " microshift" ]; then
59
+ # Pull openshift release images because as part of microshift bundle creation we
60
+ # don't run microshift service which fetch these image but instead service is run
61
+ # as part of crc so user have a fresh cluster instead something already provisioned
62
+ # but images we cache it as part of bundle.
63
+ ${SSH} core@${VM_IP} ' sudo bash -x -s' << EOF
64
+ jq --raw-output '.images | to_entries | map(.value) | join("\n")' /usr/share/microshift/release/release-$( uname -i) .json | xargs -n1 podman pull --authfile /etc/crio/openshift-pull-secret
65
+ EOF
66
+ # Disable firewalld otherwise generated bundle have it running and each podman container
67
+ # which try to expose a port need to added to firewalld rule manually
68
+ # also in case of microshift the ports like 2222, 443, 80 ..etc need to be manually added
69
+ # and OCP/OKD/podman bundles have it disabled by default.
70
+ ${SSH} core@${VM_IP} -- sudo systemctl disable firewalld
71
+ fi
72
+
48
73
# Remove audit logs
49
74
${SSH} core@${VM_IP} -- ' sudo find /var/log/ -iname "*.log" -exec rm -f {} \;'
50
75
@@ -76,7 +101,7 @@ cat crio-wipe.service | ${SSH} core@${VM_IP} "sudo tee -a /etc/systemd/system/cr
76
101
# Preload routes controller
77
102
${SSH} core@${VM_IP} -- " sudo podman pull quay.io/crcont/routes-controller:${image_tag} "
78
103
79
- if [ " ${ARCH} " == " aarch64" ]; then
104
+ if [ " ${ARCH} " == " aarch64" ] && [ ${BUNDLE_TYPE} != " okd " ] ; then
80
105
# aarch64 support is mainly used on Apple M1 machines which can't run a rhel8 kernel
81
106
# https://access.redhat.com/solutions/6545411
82
107
install_rhel9_kernel ${VM_IP}
@@ -107,12 +132,14 @@ if [ -n "${SNC_GENERATE_MACOS_BUNDLE}" ]; then
107
132
${SSH} core@${VM_IP} -- " sudo rm -fr /tmp/kernel"
108
133
fi
109
134
110
- # Add internalIP as node IP for kubelet systemd unit file
111
- # More details at https://bugzilla.redhat.com/show_bug.cgi?id=1872632
112
- ${SSH} core@${VM_IP} ' sudo bash -x -s' << EOF
135
+ if [ ${BUNDLE_TYPE} == " snc" ]; then
136
+ # Add internalIP as node IP for kubelet systemd unit file
137
+ # More details at https://bugzilla.redhat.com/show_bug.cgi?id=1872632
138
+ ${SSH} core@${VM_IP} ' sudo bash -x -s' << EOF
113
139
echo '[Service]' > /etc/systemd/system/kubelet.service.d/80-nodeip.conf
114
140
echo 'Environment=KUBELET_NODE_IP="${VM_IP} "' >> /etc/systemd/system/kubelet.service.d/80-nodeip.conf
115
141
EOF
142
+ fi
116
143
117
144
podman_version=$( ${SSH} core@${VM_IP} -- ' rpm -q --qf %{version} podman' )
118
145
@@ -136,8 +163,12 @@ libvirtDestDir="${destDirPrefix}_libvirt_${destDirSuffix}"
136
163
rm -fr ${libvirtDestDir} ${libvirtDestDir} .crcbundle
137
164
mkdir " $libvirtDestDir "
138
165
139
- create_qemu_image " $libvirtDestDir " " ${VM_PREFIX} -base" " ${VM_NAME} "
140
- mv " ${libvirtDestDir} /${VM_NAME} " " ${libvirtDestDir} /${SNC_PRODUCT_NAME} .qcow2"
166
+ if [ $BUNDLE_TYPE != " microshift" ]; then
167
+ create_qemu_image " $libvirtDestDir " " ${VM_PREFIX} -base" " ${VM_NAME} "
168
+ mv " ${libvirtDestDir} /${VM_NAME} " " ${libvirtDestDir} /${SNC_PRODUCT_NAME} .qcow2"
169
+ else
170
+ sparsify_lvm " ${libvirtDestDir} "
171
+ fi
141
172
copy_additional_files " $INSTALL_DIR " " $libvirtDestDir " " ${VM_NAME} "
142
173
create_tarball " $libvirtDestDir "
143
174
0 commit comments