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

When I execute okteto ctx command with --insecure-skip-tls-verify flag, the Insecure mode enabled message is displayed twice #3885

Closed
ifbyol opened this issue Aug 4, 2023 · 5 comments
Labels
bug Something isn't working stale

Comments

@ifbyol
Copy link
Member

ifbyol commented Aug 4, 2023

Describe the bug

When I execute okteto ctx with --insecure-skip-tls-verify flag, a warning message ! Insecure mode enabled is displayed twice

Captura de pantalla 2023-08-04 a las 18 45 10

To Reproduce
Steps to reproduce the behavior:

  1. Execute okteto ctx use https://cloud.okteto.com --insecure-skip-tls-verify

Expected behavior

The warning message is displayed only once

Desktop (please complete the following information):

Checking with different versions it seems that started to happen in 2.17.x version

Additional context
Add any other context about the problem here (e.g. okteto.yml, k8s manifests, logs)

@nitishfy
Copy link
Contributor

I'll solve this issue. Please assign this to me!

@jLopezbarb
Copy link
Contributor

Assigned!! I don't know how trivial this one is, but let us know if you face any problem and we'll try to give you some tips

@nitishfy
Copy link
Contributor

nitishfy commented Sep 21, 2023

Assigned!! I don't know how trivial this one is, but let us know if you face any problem and we'll try to give you some tips

I'm late for this but I've done my research. Here's what I have found after debugging:

The function PersistentPreRun is being called twice, first for the root and then for the context command. Everytime it is called, it is always going to be executing the okteto.SetInsecureSkipTLSVerifyPolicy(ctxOptions.InsecureSkipTlsVerify) function.

if parent := cmd.Parent(); parent != nil {
	if parent.PersistentPreRun != nil {
	   parent.PersistentPreRun(parent, args)
	}
}

When the parent.PersistentPreRun() function is called recursively for the first time, it changes it's value to main.main() due to which we are facing the above issue. For every recursive call, the function okteto.SetInsecureSkipTLSVerifyPolicy(ctxOptions.InsecureSkipTlsVerify) is called.

I think one way we can solve this is by either calling the function before the If statement OR setting up a boolean flag/count pointer.

cc: @jLopezbarb

image

@andreafalzetti
Copy link
Contributor

The change seems requiring some refactoring in order to make the change testable and avoid any workaround. I am removing the good first issue label because such change should be done and owned by the CLI team. Apologies agian @nitishfy and thanks for all your contributions 🙇

Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. Comment on this issue or it will be closed in 7 days

@github-actions github-actions bot added the stale label Dec 27, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants