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

     1  /*
     2  Copyright 2021 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  	"fmt"
    21  
    22  	clientset "k8s.io/client-go/kubernetes"
    23  	prom "k8s.io/perf-tests/clusterloader2/pkg/prometheus/clients"
    24  )
    25  
    26  type KindProvider struct {
    27  	features Features
    28  }
    29  
    30  func NewKindProvider(_ map[string]string) Provider {
    31  	return &KindProvider{
    32  		features: Features{
    33  			SupportProbe:                        true,
    34  			SupportSSHToMaster:                  false,
    35  			SupportImagePreload:                 true,
    36  			SupportEnablePrometheusServer:       true,
    37  			SupportGrabMetricsFromKubelets:      true,
    38  			SupportAccessAPIServerPprofEndpoint: true,
    39  			SupportMetricsServerMetrics:         true,
    40  			SupportResourceUsageMetering:        true,
    41  			ShouldScrapeKubeProxy:               true,
    42  		},
    43  	}
    44  }
    45  
    46  func (p *KindProvider) Name() string {
    47  	return KindName
    48  }
    49  
    50  func (p *KindProvider) Features() *Features {
    51  	return &p.features
    52  }
    53  
    54  func (p *KindProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) {
    55  	return getComponentProtocolAndPort(componentName)
    56  }
    57  
    58  func (p *KindProvider) GetConfig() Config {
    59  	return Config{}
    60  }
    61  
    62  func (p *KindProvider) RunSSHCommand(cmd, host string) (string, string, int, error) {
    63  	// TODO(#1693): To maintain compatibility with the use of SSH to scrape measurements,
    64  	// we can SSH to localhost then run `docker exec -t <masterNodeContainerID> <cmd>`.
    65  	return "", "", 0, fmt.Errorf("kind: ssh not yet implemented")
    66  }
    67  
    68  func (p *KindProvider) Metadata(client clientset.Interface) (map[string]string, error) {
    69  	return nil, nil
    70  }
    71  
    72  func (p *KindProvider) GetManagedPrometheusClient() (prom.Client, error) {
    73  	return nil, ErrNoManagedPrometheus
    74  }