-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix setting kubeContext
in skaffold
#6024
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,21 +44,14 @@ var ( | |
// When given, the firstCliValue always takes precedence over the yamlValue. | ||
// Changing the kube-context of a running Skaffold process is not supported, so | ||
// after the first call, the kube-context will be locked. | ||
func ConfigureKubeConfig(cliKubeConfig, cliKubeContext, yamlKubeContext string) { | ||
newKubeContext := yamlKubeContext | ||
if cliKubeContext != "" { | ||
newKubeContext = cliKubeContext | ||
} | ||
func ConfigureKubeConfig(cliKubeConfig, cliKubeContext string) { | ||
configureOnce.Do(func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In an ideal world, There are also the |
||
kubeContext = newKubeContext | ||
kubeContext = cliKubeContext | ||
kubeConfigFile = cliKubeConfig | ||
if kubeContext != "" { | ||
logrus.Infof("Activated kube-context %q", kubeContext) | ||
} | ||
}) | ||
if kubeContext != newKubeContext { | ||
logrus.Warn("Changing the kube-context is not supported after startup. Please restart Skaffold to take effect.") | ||
} | ||
} | ||
|
||
// GetRestClientConfig returns a REST client config for API calls against the Kubernetes API. | ||
|
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.
I feel this should happen only for dev, run and deploy commands.
Not sure if this is the current behavior.
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.
unfortunately we evaluate the global config for all skaffold commands when we evaluate
config.ShouldDisplaySurveyPrompt
. We need to interpret the resolvedkubeContext
prior to evaluating the global config. So we need to do this check here also.