// ConfirmUsable looks a particular context and determines if that particular part of the config is useable. There might still be errors in the config,
// but no errors in the sections requested or referenced. It does not return early so that it can find as many errors as possible.
validationErrors=append(validationErrors,fmt.Errorf("certificate-authority-data and certificate-authority are both specified for %v. certificate-authority-data will override.",clusterName))
validationErrors=append(validationErrors,fmt.Errorf("unable to read certificate-authority %v for %v due to %v",clusterInfo.CertificateAuthority,clusterName,err))
}
}
returnvalidationErrors
}
// validateAuthInfo looks for conflicts and errors in the auth info
validationErrors=append(validationErrors,fmt.Errorf("client-cert-data and client-cert are both specified for %v. client-cert-data will override.",authInfoName))
}
// Make sure key data and file aren't both specified
validationErrors=append(validationErrors,fmt.Errorf("client-key-data and client-key are both specified for %v; client-key-data will override",authInfoName))
validationErrors=append(validationErrors,fmt.Errorf("client-key-data or client-key must be specified for %v to use the clientCert authentication method.",authInfoName))
validationErrors=append(validationErrors,fmt.Errorf("authProvider cannot be provided in combination with an exec plugin for %s",authInfoName))
}
iflen(authInfo.Exec.Command)==0{
validationErrors=append(validationErrors,fmt.Errorf("command must be specified for %v to use exec authentication plugin",authInfoName))
}
iflen(authInfo.Exec.APIVersion)==0{
validationErrors=append(validationErrors,fmt.Errorf("apiVersion must be specified for %v to use exec authentication plugin",authInfoName))
}
for_,v:=rangeauthInfo.Exec.Env{
iflen(v.Name)==0{
validationErrors=append(validationErrors,fmt.Errorf("env variable name must be specified for %v to use exec authentication plugin",authInfoName))
}elseiflen(v.Value)==0{
validationErrors=append(validationErrors,fmt.Errorf("env variable %s value must be specified for %v to use exec authentication plugin",v.Name,authInfoName))
// authPath also provides information for the client to identify the server, so allow multiple auth methods in that case
if(len(methods)>1)&&(!usingAuthPath){
validationErrors=append(validationErrors,fmt.Errorf("more than one authentication method found for %v; found %v, only one is allowed",authInfoName,methods))
}
// ImpersonateGroups or ImpersonateUserExtra should be requested with a user
validationErrors=append(validationErrors,fmt.Errorf("requesting groups or user-extra for %v without impersonating a user",authInfoName))
}
returnvalidationErrors
}
// validateContext looks for errors in the context. It is not transitive, so errors in the reference authInfo or cluster configs are not included in this return
validationErrors=append(validationErrors,fmt.Errorf("namespace %q for context %q does not conform to the kubernetes DNS_LABEL rules",context.Namespace,contextName))