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

Merge kubeconfig files for config #1883

Merged
merged 8 commits into from Nov 9, 2021

Conversation

jLopezbarb
Copy link
Contributor

Signed-off-by: Javier López Barba javier@okteto.com

Fixes #1433

Proposed changes

  • Merge kubeconfig files from KUBECONFIG env into a single config

Signed-off-by: Javier López Barba <javier@okteto.com>
@jLopezbarb jLopezbarb requested a review from a team October 26, 2021 16:33
Signed-off-by: Javier López Barba <javier@okteto.com>
@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #1883 (51b1d05) into master (4e576ef) will increase coverage by 0.04%.
The diff coverage is 35.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1883      +/-   ##
==========================================
+ Coverage   33.42%   33.46%   +0.04%     
==========================================
  Files         122      123       +1     
  Lines       13847    13873      +26     
==========================================
+ Hits         4628     4643      +15     
- Misses       8719     8728       +9     
- Partials      500      502       +2     
Impacted Files Coverage Δ
cmd/context/update-kubeconfig.go 0.00% <0.00%> (ø)
pkg/config/config.go 20.38% <0.00%> (ø)
pkg/k8s/kubeconfig/client.go 26.92% <62.50%> (ø)
pkg/okteto/context.go 18.53% <0.00%> (+1.29%) ⬆️
pkg/okteto/k8s.go 11.62% <0.00%> (+11.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e576ef...51b1d05. Read the comment docs.

@@ -147,14 +147,14 @@ func Run(ctx context.Context, ctxOptions *ContextOptions) error {
if err := okteto.WriteOktetoContextConfig(); err != nil {
return err
}
if err := kubeconfig.Write(okteto.Context().Cfg, config.GetKubeconfigPath()); err != nil {
if err := kubeconfig.Write(okteto.Context().Cfg, config.GetKubeconfigPath()[0]); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

if we always get config.GetKubeconfigPath()[0], should the function return just the first element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is just to copy the current config into one of the files KUBECONFIG env var has. We are returning a list with all the Kubernetes config paths most of the time

@rberrelleza
Copy link
Member

Could we add a test for this scenario?

Signed-off-by: Javier López Barba <javier@okteto.com>
Signed-off-by: Javier López Barba <javier@okteto.com>
Signed-off-by: Javier López Barba <javier@okteto.com>
Signed-off-by: Javier López Barba <javier@okteto.com>
Signed-off-by: Javier López Barba <javier@okteto.com>
@derek derek bot added the no-dco label Nov 9, 2021
@derek
Copy link

derek bot commented Nov 9, 2021

Thank you for your contribution. unfortunately, one or more of your commits are missing the required "Signed-off-by:" statement. Signing off is part of the Developer Certificate of Origin (DCO) which is used by this project.

Read the DCO and project contributing guide carefully, and amend your commits using the git CLI. Note that this does not require any cryptography, keys or special steps to be taken.

💡 Shall we fix this?

This will only take a few moments.

First, clone your fork and checkout this branch using the git CLI.

Next, set up your real name and email address:

git config --global user.name "Your Full Name"
git config --global user.email "you@domain.com"

Finally, run one of these commands to add the "Signed-off-by" line to your commits.

If you only have one commit so far then run: git commit --amend --signoff and then git push --force.
If you have multiple commits, watch this video.

Check that the message has been added properly by running "git log".

@jLopezbarb jLopezbarb merged commit 58b84c1 into master Nov 9, 2021
@jLopezbarb jLopezbarb deleted the jlopezbarb/fix-multiple-files-on-kubeconfig branch November 9, 2021 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"okteto namespace" not working if KUBECONFIG points to several files
3 participants