-
Notifications
You must be signed in to change notification settings - Fork 49
Pass kubeconfig content around rather than file path #631
Conversation
7f82e75
to
57a8710
Compare
530b04a
to
2dae3ce
Compare
After this PR, last step is to read kubeconfig file content from Terraform state. This requires:
|
2dae3ce
to
e9b259a
Compare
Getter struct and NewGetter function is a replacement for helm.sh/helm/v3/pkg/kube.GetConfig(), which allows to create Helm action config from the content of kubeconfig file, instead of from the path of the file, which is part of #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
As part of #608, this commit changes the implementation of HelmActionConfig function to read the content of given kubeconfig file and then use the content to construct Helm's actionConfig. This will make easier changing the function signature to accept content of kubeconfig file in the future changes. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
As component-oriented functionality should be stored in pkg/components and cli package should not go too much into helm details etc. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Instead of kubeconfig file path. This simplifies the tests and moves us closer towards resolving #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Instead, change verifyCluster function to take content of kubeconfig file as an argument, which caller should already have. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So we don't necesserily need a file on file system to perfrom this action, which is needed to resolve #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
This commit changes InstallComponent and InstallAsRelease methods to accept kubeconfig content, rather than the file path, to allow loading it from places other than local filesystem. Part of #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
The subcommand function will fail anyway while trying to read kubeconfig file, so there is no need to check it twice. Also part of #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Rather than kubeconfig file path. This will allow changing this function to pull kubeconfig content from Terraform output rather than from assets directory, which will resolve #608. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
e9b259a
to
b65cf5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commits that move code from from cli to util package such as deleteComponent.
Its great that you have taken this out of cli
package but I have reservations about this in this PR.
Do you mean that I move |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I would say no need to remove it now, this looks completely fine |
If its a small thing to do, then I'd like that to keep them separate. However if its going to be bit more than tiny overhead, its fine as is. I'll let you make the call. |
Unfortunately, it won't be a tiny thing, as moved function is changed afterwards, so I'll just keep it as it is and merge. Thanks! |
This PR includes commits from #628, please review this one first and don't leave commit comments for this PR here.
This PR changes a lot of the code to accept kubeconfig content rather than kubeconfig path, so we will be able to read it from Terraform state/output in the future, which is needed for #608. It also shows, how poorly the code is structured, as such change requite so much code changes. We should make most of this function to execute in the scope/context (so make them have a receiver), which already has access to the kubeconfig content, as the kubeconfig content is almost constant in calls of this functions.
Please review the PR commit by commit, as each of them contains small, logical and independent changes, described a bit in commit message.
Now that reading kubeconfig file is in single place, we can implement reading it from Terraform state.
Closes #623
Part of #608