Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate host-agent with the installer #216

Merged
merged 1 commit into from
Nov 8, 2021

Conversation

anusha94
Copy link
Contributor

@anusha94 anusha94 commented Nov 8, 2021

Signed-off-by: Anusha Hegde anushah@vmware.com

What this PR does / why we need it:

  • introduce a new flag skip-installation for the host-agent. The site
    operators can use this flag if they wish to manage the k8s components
    themselves
  • refactor installer to update New, Install and Uninstall signatures

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #204

- introduce a new flag skip-installation for the host-agent. The site
  operators can use this flag if they wish to manage the k8s components
  themselves
- refactor installer to update New, Install and Uninstall signatures

Signed-off-by: Anusha Hegde <anushah@vmware.com>
Copy link
Contributor

@ratanasovvmw ratanasovvmw left a comment

Choose a reason for hiding this comment

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

I recommend to split these reviews in 2 so they are smaller

  • integration
  • installer refactoring if needed

}

// Install installs the specified k8s version on the current OS
func (i *installer) Install(k8sVer, tag string) error {
func (i *installer) Install(bundleRepo, k8sVer, tag string) error {
i.bundleDownloader = bundleDownloader{repoAddr: bundleRepo, downloadPath: i.downloadPath, logger: i.logger}
Copy link
Contributor

Choose a reason for hiding this comment

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

it's bad design that this method modifies the installer object. Same for uninstall.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. This needs to be refactored. I think the old assumption was that we would have the repoAddr when the host-agent was started. But this assumption was false. The repoAddr will be passed in at Install / Uninstall time, so there is no point saving it. We just took the path of least resistance to get the installer integrated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #221 to track this work

Copy link
Contributor

Choose a reason for hiding this comment

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

I acknowledge the least resistance for FC. That was to New every time. A much smaller and safer change.

if bundleRepo == "" {
return nil, fmt.Errorf("empty bundle repo")
}
func New(downloadPath string, logger logr.Logger) (*installer, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

downloadPath goes with bundleRepo. It's a cache of the bundle repo. It's odd that they are decoupled in different methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought downloadPath is a location on disk to cache the repo. Why would it be coupled to the bundleRepo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed "cache the repo" - yes. After this change there is no "the repo"

This change makes the cache shareable between repos. If they happen to have different bundles with the same k8s version, this will simply not work as they will clash and will have false hits. Installer assumes 1 repo, 1 local cache. This change is half-making another model.

In a model where there are different repos, each of them must have it's own cache. So no collisions are possible.

Copy link
Contributor

@dharmjit dharmjit left a comment

Choose a reason for hiding this comment

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

LGTM!

@dharmjit
Copy link
Contributor

dharmjit commented Nov 8, 2021

We could open a linked Issue in case there are some code improvements or code refactoring is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate host agent with the installer
6 participants