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

Reorganize structs in different files #19

Closed
wants to merge 1 commit into from
Closed

Conversation

nicholastmosher
Copy link
Contributor

This is the first part of merging @andreclaudino's changes from #14. This first commit is a lot of moving code around, which was making it hard to review other meaningful changes. I've looked over this and everything looks good, hopefully by merging it we'll be able to reduce the diff noise in #14.

@nicholastmosher nicholastmosher requested a review from sehz June 18, 2021 21:36
Copy link
Contributor

@sehz sehz left a comment

Choose a reason for hiding this comment

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

See inline comments. I think commands should be grouped together

///
/// This only succeeds if the helm command can be found.
pub fn new() -> Result<Self, HelmError> {
let output = Command::new("helm").arg("version").result()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should store version


/// Adds a new helm repo with the given chart name and chart location
#[instrument(skip(self))]
pub fn repo_add(&self, chart: &str, location: &str) -> Result<(), HelmError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like repo related commands should be move to it's own builder type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tracking feedback in #21

I think it would be good to tackle this in another PR since this one is purely refactoring

src/helm_client.rs Show resolved Hide resolved

/// Searches the repo for the named helm chart
#[instrument(skip(self))]
pub fn search_repo(&self, chart: &str, version: &str) -> Result<Vec<Chart>, HelmError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment about repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#21

/// Get all the available versions
#[instrument(skip(self))]
pub fn versions(&self, chart: &str) -> Result<Vec<Chart>, HelmError> {
let mut command = Command::new("helm");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be moved into Charts objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created this to track this feedback: #20


/// Checks that a given version of a given chart exists in the repo.
#[instrument(skip(self))]
pub fn chart_version_exists(&self, name: &str, version: &str) -> Result<bool, HelmError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to repo, I think we should move all chart related commands to Chart object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#20


/// Installer Argument
#[derive(Debug)]
pub struct InstallArg {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use builder to reduce boiler plate?


/// Uninstaller Argument
#[derive(Debug)]
pub struct UninstallArg {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest have different types of builder. For example, helm.install_builder(), helm.uninstall_builder(). etc

@nicholastmosher
Copy link
Contributor Author

Hi @sehz, this PR is strictly a refactoring, there is no change to the structs or functions that are currently in master. This was put together by @andreclaudino to help clean things up a bit. They have also made many more commits on their own fork of fluvio-helm over at https://github.com/Talentify/fluvio-helm (you can see the full set of commits they have added in this diff main...Talentify:main).

I am trying to work through their commits a little bit at a time, starting with this one that is simply breaking out modules without any actual code changes. I believe further commits have actual improvements such as additional features or improvements to the API (that may solve some of the problems you have mentioned here).

I think it'd be a good idea to merge this PR as a solid incremental improvement and we can turn some of your comments into issues that we'd eventually like to address in this project.

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

Successfully merging this pull request may close these issues.

2 participants