k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/pkg/provider/autopilot.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 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 AutopilotProvider struct { 26 features Features 27 } 28 29 func NewAutopilotProvider(_ map[string]string) Provider { 30 return &AutopilotProvider{ 31 features: Features{ 32 SupportProbe: false, 33 SupportImagePreload: false, 34 SupportSnapshotPrometheusDisk: true, 35 SupportEnablePrometheusServer: true, 36 SupportGrabMetricsFromKubelets: true, 37 SupportAccessAPIServerPprofEndpoint: true, 38 SupportNodeKiller: false, 39 ShouldPrometheusScrapeApiserverOnly: true, 40 ShouldScrapeKubeProxy: false, 41 }, 42 } 43 } 44 45 func (p *AutopilotProvider) Name() string { 46 return AutopilotName 47 } 48 49 func (p *AutopilotProvider) Features() *Features { 50 return &p.features 51 } 52 53 func (p *AutopilotProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) { 54 return getComponentProtocolAndPort(componentName) 55 } 56 57 func (p *AutopilotProvider) GetConfig() Config { 58 return Config{} 59 } 60 61 func (p *AutopilotProvider) RunSSHCommand(cmd, host string) (string, string, int, error) { 62 // gce provider takes ssh key from GCE_SSH_KEY. 63 r, err := sshutil.SSH(cmd, host, "gce") 64 return r.Stdout, r.Stderr, r.Code, err 65 } 66 67 func (p *AutopilotProvider) Metadata(client clientset.Interface) (map[string]string, error) { 68 return nil, nil 69 } 70 71 func (p *AutopilotProvider) GetManagedPrometheusClient() (prom.Client, error) { 72 return prom.NewGCPManagedPrometheusClient() 73 }