mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-10 03:37:31 +00:00
test/e2e_node: install and configure kubelet credential provider
Signed-off-by: Andrew Sy Kim <andrewsy@google.com> Co-authored-by: Aditi Sharma <adi.sky17@gmail.com>
This commit is contained in:
@@ -48,6 +48,16 @@ const cniConfig = `{
|
||||
}
|
||||
`
|
||||
|
||||
const credentialProviderConfig = `kind: CredentialProviderConfig
|
||||
apiVersion: kubelet.config.k8s.io/v1alpha1
|
||||
providers:
|
||||
- name: credential-provider
|
||||
apiVersion: credentialprovider.kubelet.k8s.io/v1alpha1
|
||||
matchImages:
|
||||
- "gcr.io"
|
||||
- "*.gcr.io"
|
||||
defaultCacheDuration: 1m`
|
||||
|
||||
// Install the cni plugin and add basic bridge configuration to the
|
||||
// configuration directory.
|
||||
func setupCNI(host, workspace string) error {
|
||||
@@ -76,6 +86,19 @@ func setupCNI(host, workspace string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func configureCredentialProvider(host, workspace string) error {
|
||||
klog.V(2).Infof("Configuring kubelet credential provider on %q", host)
|
||||
|
||||
cmd := getSSHCommand(" ; ",
|
||||
fmt.Sprintf("echo %s > %s", quote(credentialProviderConfig), filepath.Join(workspace, "credential-provider.yaml")),
|
||||
)
|
||||
if output, err := SSH(host, "sh", "-c", cmd); err != nil {
|
||||
return fmt.Errorf("failed to write credential provider configuration on %q: %v output: %q", host, err, output)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// configureFirewall configures iptable firewall rules.
|
||||
func configureFirewall(host string) error {
|
||||
klog.V(2).Infof("Configure iptables firewall rules on %q", host)
|
||||
|
||||
Reference in New Issue
Block a user