-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
K8sInstallerConfig controller implementation added (#526)
K8sInstallerConfig controller will be generation the installation secret for the bundleType to install on byohost test cases added To increase the test coverage, few test cases added for k8sinstallercontroller - should not return reconcile request if ByoMachine InstallerRef doesn't exists - should not return reconcile request if ByoMachine InstallerRef doesn't refer to K8sInstallerConfitTemplate - should return reconcile request if ByoMachine refer to K8sInstallerConfigTemplate installer Signed-off-by: Mayur Das <[email protected]>
- Loading branch information
1 parent
c917aec
commit 779caac
Showing
16 changed files
with
1,243 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2022 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package installer | ||
|
||
import ( | ||
"github.com/go-logr/logr" | ||
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/installer" | ||
) | ||
|
||
// BundleDownloader represent a bundle downloader interface | ||
type BundleDownloader interface { | ||
GetBundleAddr(normalizedOsVersion, k8sVersion, tag string) string | ||
} | ||
|
||
// DefaultBundleDownloader implement the downloader interface | ||
func DefaultBundleDownloader(bundleType, repoAddr, downloadPath string, logger logr.Logger) BundleDownloader { | ||
return installer.NewBundleDownloader(installer.BundleType(bundleType), repoAddr, downloadPath, logger) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2022 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package installer | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/agent/installer" | ||
"github.com/vmware-tanzu/cluster-api-provider-bringyourownhost/common/installer/internal/algo" | ||
) | ||
|
||
// K8sInstaller represent k8s installer interface | ||
type K8sInstaller interface { | ||
Install() string | ||
Uninstall() string | ||
} | ||
|
||
// NewInstaller will return a new installer | ||
func NewInstaller(ctx context.Context, osDist, arch, k8sVersion string, downloader BundleDownloader) (K8sInstaller, error) { | ||
// normalizing os image name and adding arch | ||
osArch := strings.ReplaceAll(osDist, " ", "_") + "_" + arch | ||
|
||
reg := installer.GetSupportedRegistry(nil) | ||
if len(reg.ListK8s(osArch)) == 0 { | ||
return nil, installer.ErrOsK8sNotSupported | ||
} | ||
_, osbundle := reg.GetInstaller(osArch, k8sVersion) | ||
addrs := downloader.GetBundleAddr(osbundle, k8sVersion, k8sVersion) | ||
|
||
return algo.NewUbuntu20_04Installer(ctx, arch, addrs) | ||
} |
Oops, something went wrong.