mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-10 19:38:57 +00:00
forbid unnamed context
Kubernetes-commit: 792a2299362ebadc9ca68c72347884330db23b2a
This commit is contained in:
committed by
Kubernetes Publisher
parent
18ec62fe90
commit
370f3b346b
@@ -253,6 +253,10 @@ func validateAuthInfo(authInfoName string, authInfo clientcmdapi.AuthInfo) []err
|
||||
func validateContext(contextName string, context clientcmdapi.Context, config clientcmdapi.Config) []error {
|
||||
validationErrors := make([]error, 0)
|
||||
|
||||
if len(contextName) == 0 {
|
||||
validationErrors = append(validationErrors, fmt.Errorf("empty context name for %#v is not allowed", context))
|
||||
}
|
||||
|
||||
if len(context.AuthInfo) == 0 {
|
||||
validationErrors = append(validationErrors, fmt.Errorf("user was not specified for context %q", contextName))
|
||||
} else if _, exists := config.AuthInfos[context.AuthInfo]; !exists {
|
||||
|
Reference in New Issue
Block a user