Skip to content

Commit

Permalink
fixed: Byoh hostinfo.architecture is not matching with the supported …
Browse files Browse the repository at this point in the history
…bundle name (#551)

in installer package, replaced the new architecture name with the old one to
match with the bundle name

Signed-off-by: Mayur Das <dmayur@vmware.com>
mayur-tolexo authored May 20, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 90b58d9 commit 1917890
Showing 3 changed files with 23 additions and 10 deletions.
12 changes: 11 additions & 1 deletion common/installer/installer.go
Original file line number Diff line number Diff line change
@@ -17,10 +17,20 @@ type K8sInstaller interface {
Uninstall() string
}

// archOldNameMap keeps the mapping of architecture new name to old name mapping
var archOldNameMap = map[string]string{
"amd64": "x86-64",
}

// NewInstaller will return a new installer
func NewInstaller(ctx context.Context, osDist, arch, k8sVersion string, downloader BundleDownloader) (K8sInstaller, error) {
bundleArchName := arch
// replacing the arch name to old name to match with the bundle name
if _, exists := archOldNameMap[arch]; exists {
bundleArchName = archOldNameMap[arch]
}
// normalizing os image name and adding arch
osArch := strings.ReplaceAll(osDist, " ", "_") + "_" + arch
osArch := strings.ReplaceAll(osDist, " ", "_") + "_" + bundleArchName

reg := installer.GetSupportedRegistry(nil)
if len(reg.ListK8s(osArch)) == 0 {
15 changes: 9 additions & 6 deletions common/installer/internal/algo/ubuntu20_4k8s.go
Original file line number Diff line number Diff line change
@@ -83,17 +83,18 @@ if ! command -v imgpkg >>/dev/null; then
chmod +x /usr/local/bin/imgpkg
fi
if [ ! -d $BUNDLE_PATH ]; then
echo "downloading bundle"
imgpkg pull -r -i $BUNDLE_ADDR -o $BUNDLE_PATH
fi
echo "downloading bundle"
mkdir -p $BUNDLE_PATH
imgpkg pull -r -i $BUNDLE_ADDR -o $BUNDLE_PATH
## disable swap
swapoff -a && sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
## disable firewall
ufw disable
if command -v ufw >>/dev/null; then
ufw disable
fi
## load kernal modules
modprobe overlay && modprobe br_netfilter
@@ -123,7 +124,9 @@ BUNDLE_PATH=$BUNDLE_DOWNLOAD_PATH/$BUNDLE_ADDR
swapon -a && sed -ri '/\sswap\s/s/^#?//' /etc/fstab
## enable firewall
ufw enable
if command -v ufw >>/dev/null; then
ufw enable
fi
## remove kernal modules
modprobe -r overlay && modprobe -r br_netfilter
Original file line number Diff line number Diff line change
@@ -191,17 +191,17 @@ var _ = Describe("Controllers/K8sInstallerConfigController", func() {
ph, err := patch.NewHelper(byoMachine, k8sClientUncached)
Expect(err).ShouldNot(HaveOccurred())
byoMachine.Status.HostInfo = infrav1.HostInfo{
Architecture: "x86-64",
Architecture: "amd64",
OSName: "linux",
OSImage: "Ubuntu 20.04.1",
OSImage: "Ubuntu 20.04.1 LTS",
}
conditions.Set(byoMachine, &clusterv1.Condition{
Type: infrav1.BYOHostReady,
Reason: infrav1.InstallationSecretNotAvailableReason,
})
Expect(ph.Patch(ctx, byoMachine, patch.WithStatusObservedGeneration{})).Should(Succeed())
WaitForObjectToBeUpdatedInCache(byoMachine, func(object client.Object) bool {
return object.(*infrav1.ByoMachine).Status.HostInfo.Architecture == "x86-64"
return object.(*infrav1.ByoMachine).Status.HostInfo.Architecture == "amd64"
})
})

0 comments on commit 1917890

Please sign in to comment.