exec credential provider: InteractiveMode support

The value here is that the exec plugin author can use the kubeconfig to assert
how standard input is treated with respect to the exec plugin, e.g.,
- an exec plugin author can ensure that kubectl fails if it cannot provide
  standard input to an exec plugin that needs it (Always)
- an exec plugin author can ensure that an client-go process will still call an
  exec plugin that prefers standard input even if standard input is not
  available (IfAvailable)

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler
2021-06-14 17:15:36 -04:00
parent 98587127da
commit cd83d89ac9
20 changed files with 664 additions and 85 deletions

View File

@@ -438,6 +438,7 @@ func TestExecPluginViaClient(t *testing.T) {
"--random-arg-to-avoid-authenticator-cache-hits",
rand.String(10),
},
InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode,
}
clientConfig.Wrap(func(rt http.RoundTripper) http.RoundTripper {
return roundTripperFunc(func(req *http.Request) (*http.Response, error) {
@@ -653,7 +654,8 @@ func TestExecPluginViaInformer(t *testing.T) {
clientConfig.ExecProvider = &clientcmdapi.ExecConfig{
Command: "testdata/exec-plugin.sh",
// TODO(ankeesler): move to v1 once exec plugins go GA.
APIVersion: "client.authentication.k8s.io/v1beta1",
APIVersion: "client.authentication.k8s.io/v1beta1",
InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode,
}
if test.clientConfigFunc != nil {
@@ -687,7 +689,8 @@ func (e *execPlugin) config() *clientcmdapi.ExecConfig {
return &clientcmdapi.ExecConfig{
Command: "testdata/exec-plugin.sh",
// TODO(ankeesler): move to v1 once exec plugins go GA.
APIVersion: "client.authentication.k8s.io/v1beta1",
APIVersion: "client.authentication.k8s.io/v1beta1",
InteractiveMode: clientcmdapi.IfAvailableExecInteractiveMode,
Env: []clientcmdapi.ExecEnvVar{
{
Name: outputFileEnvVar,