Set a special proxy environment just for the "pinniped login oidc" command in the E2E test.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
ddd1d29e5d
commit
9a0f75980d
@ -26,6 +26,7 @@ import (
|
|||||||
authorizationv1 "k8s.io/api/authorization/v1"
|
authorizationv1 "k8s.io/api/authorization/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
rbacv1 "k8s.io/api/rbac/v1"
|
rbacv1 "k8s.io/api/rbac/v1"
|
||||||
|
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||||
|
|
||||||
authv1alpha "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1"
|
authv1alpha "go.pinniped.dev/generated/latest/apis/concierge/authentication/v1alpha1"
|
||||||
configv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
|
configv1alpha1 "go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1"
|
||||||
@ -162,6 +163,17 @@ func TestE2EFullIntegration(t *testing.T) {
|
|||||||
restConfig := library.NewRestConfigFromKubeconfig(t, kubeconfigYAML)
|
restConfig := library.NewRestConfigFromKubeconfig(t, kubeconfigYAML)
|
||||||
require.NotNil(t, restConfig.ExecProvider)
|
require.NotNil(t, restConfig.ExecProvider)
|
||||||
require.Equal(t, []string{"login", "oidc"}, restConfig.ExecProvider.Args[:2])
|
require.Equal(t, []string{"login", "oidc"}, restConfig.ExecProvider.Args[:2])
|
||||||
|
|
||||||
|
// If there is a proxy, we always want the "pinniped login oidc" command to use it, even if the
|
||||||
|
// parent kubectl process is connecting to an external load balancer and not using the proxy.
|
||||||
|
if env.Proxy != "" {
|
||||||
|
restConfig.ExecProvider.Env = append(restConfig.ExecProvider.Env,
|
||||||
|
clientcmdapi.ExecEnvVar{Name: "http_proxy", Value: env.Proxy},
|
||||||
|
clientcmdapi.ExecEnvVar{Name: "https_proxy", Value: env.Proxy},
|
||||||
|
clientcmdapi.ExecEnvVar{Name: "no_proxy", Value: "127.0.0.1"},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
kubeconfigPath := filepath.Join(tempDir, "kubeconfig.yaml")
|
kubeconfigPath := filepath.Join(tempDir, "kubeconfig.yaml")
|
||||||
require.NoError(t, ioutil.WriteFile(kubeconfigPath, []byte(kubeconfigYAML), 0600))
|
require.NoError(t, ioutil.WriteFile(kubeconfigPath, []byte(kubeconfigYAML), 0600))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user