Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

cli/cmd: cleanups part 3 #1018

Merged
merged 12 commits into from
Oct 22, 2020
Merged

cli/cmd: cleanups part 3 #1018

merged 12 commits into from
Oct 22, 2020

Conversation

invidian
Copy link
Member

@invidian invidian commented Sep 25, 2020

Includes commits from #1015

Part of #603.

ipochi
ipochi previously approved these changes Oct 21, 2020
Copy link
Member

@ipochi ipochi left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@invidian
Copy link
Member Author

@ipochi I had to rebase, one more LGTM?

ipochi
ipochi previously approved these changes Oct 21, 2020
So all subcommands use the same function to determine which components
should be used.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
As it does not add any value, as we create a slice of objects anyway
instead of specifying them by hand.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To soften the dependency on log.Entry and to separate the functionality
from CLI code. This also makes code easier to move around and avoids
hiding function complexity.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So they are easier to trace and debug.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To soften the dependency on log.Entry and to separate the functionality
from CLI code. This also makes code easier to move around and avoids
hiding function complexity.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
@knrt10
Copy link
Member

knrt10 commented Oct 22, 2020

CI was not triggering, so I had to re-push

iaguis
iaguis previously requested changes Oct 22, 2020
Copy link
Contributor

@iaguis iaguis left a comment

Choose a reason for hiding this comment

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

Small nit.

cli/cmd/component-delete.go Outdated Show resolved Hide resolved
@@ -187,7 +187,10 @@ func readKubeconfigFromTerraformState(contextLogger *log.Entry) ([]byte, error)
contextLogger.Warn("Kubeconfig file not found in assets directory, pulling kubeconfig from " +
"Terraform state, this might be slow. Run 'lokoctl cluster apply' to fix it.")

c, err := initialize(contextLogger)
// TODO: Add Terraform verbose support back.
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand this means you can't configure verboseness when reading the kubeconfig from the terraform state.

In that case I think I'm fine with this.

@@ -111,7 +111,11 @@ func clusterApply(contextLogger *log.Entry, options clusterApplyOptions) error {

fmt.Printf("\nYour configurations are stored in %s\n", c.assetDir)

kubeconfig, err := getKubeconfig(contextLogger, c.lokomotiveConfig, true)
kg := kubeconfigGetter{
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not super convinced by this getter (especially regarding naming) but I think this is an improvement over the current state so I'm not blocking this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, once moved to separate package, we need to continue refactoring...

invidian and others added 7 commits October 22, 2020 17:05
To soften the dependency on log.Entry and to separate the functionality
from CLI code. This also makes code easier to move around and avoids
hiding function complexity.

Part of #630

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Co-authored-by: knrt10 <kautilya@kinvolk.io>
This should allow better structure for the code and should make easier
to move this code to some other package.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Pass required information via options struct instead.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Use options struct instead.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Co-authored-by: knrt10 <kautilya@kinvolk.io>
Use config struct instead.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
To add it a name and also to allow adding more information there, to
separate this code from CLI code.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Pass explicity kubeconfig path via options instead.

Also fixes #1094.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

looks ok

@knrt10 knrt10 requested a review from iaguis October 22, 2020 12:24
@knrt10 knrt10 dismissed iaguis’s stale review October 22, 2020 12:24

re-requested review

Copy link
Contributor

@iaguis iaguis left a comment

Choose a reason for hiding this comment

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

lgtm

@knrt10 knrt10 merged commit d0e87eb into master Oct 22, 2020
@knrt10 knrt10 deleted the invidian/cli-cleanup-part3 branch October 22, 2020 13:18
@invidian invidian restored the invidian/cli-cleanup-part3 branch October 22, 2020 21:02
@invidian invidian deleted the invidian/cli-cleanup-part3 branch October 22, 2020 21:03
@invidian
Copy link
Member Author

Thanks for merging!

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

Successfully merging this pull request may close these issues.

5 participants