k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/pkg/provider/eks.go (about)

     1  /*
     2  Copyright 2020 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package provider
    18  
    19  import (
    20  	clientset "k8s.io/client-go/kubernetes"
    21  	sshutil "k8s.io/kubernetes/test/e2e/framework/ssh"
    22  	prom "k8s.io/perf-tests/clusterloader2/pkg/prometheus/clients"
    23  )
    24  
    25  type EKSProvider struct {
    26  	features Features
    27  }
    28  
    29  func NewEKSProvider(_ map[string]string) Provider {
    30  	return &EKSProvider{
    31  		features: Features{
    32  			ShouldPrometheusScrapeApiserverOnly: true,
    33  			SupportProbe:                        true,
    34  			SupportImagePreload:                 true,
    35  			SupportEnablePrometheusServer:       true,
    36  			SupportGrabMetricsFromKubelets:      true,
    37  			SupportAccessAPIServerPprofEndpoint: true,
    38  			SupportResourceUsageMetering:        true,
    39  			ShouldScrapeKubeProxy:               true,
    40  			SupportKubeStateMetrics:             true,
    41  		},
    42  	}
    43  }
    44  
    45  func (p *EKSProvider) Name() string {
    46  	return EKSName
    47  }
    48  
    49  func (p *EKSProvider) Features() *Features {
    50  	return &p.features
    51  }
    52  
    53  func (p *EKSProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) {
    54  	return getComponentProtocolAndPort(componentName)
    55  }
    56  
    57  func (p *EKSProvider) GetConfig() Config {
    58  	return Config{}
    59  }
    60  
    61  func (p *EKSProvider) RunSSHCommand(cmd, host string) (string, string, int, error) {
    62  	// eks provider takes ssh key from AWS_SSH_KEY.
    63  	r, err := sshutil.SSH(cmd, host, "eks")
    64  	return r.Stdout, r.Stderr, r.Code, err
    65  }
    66  
    67  func (p *EKSProvider) Metadata(client clientset.Interface) (map[string]string, error) {
    68  	return nil, nil
    69  }
    70  
    71  func (p *EKSProvider) GetManagedPrometheusClient() (prom.Client, error) {
    72  	return nil, ErrNoManagedPrometheus
    73  }