workloads.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package workloads
  14. import (
  15. "time"
  16. v1 "k8s.io/api/core/v1"
  17. kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
  18. )
  19. // NodePerfWorkload provides the necessary information to run a workload for
  20. // node performance testing.
  21. type NodePerfWorkload interface {
  22. // Name of the workload.
  23. Name() string
  24. // PodSpec used to run this workload.
  25. PodSpec() v1.PodSpec
  26. // Timeout provides the expected time to completion
  27. // for this workload.
  28. Timeout() time.Duration
  29. // KubeletConfig specifies the Kubelet configuration
  30. // required for this workload.
  31. KubeletConfig(old *kubeletconfig.KubeletConfiguration) (new *kubeletconfig.KubeletConfiguration, err error)
  32. // PreTestExec is used for defining logic that needs
  33. // to be run before restarting the Kubelet with the new Kubelet
  34. // configuration required for the workload.
  35. PreTestExec() error
  36. // PostTestExec is used for defining logic that needs
  37. // to be run after the workload has completed.
  38. PostTestExec() error
  39. // ExtractPerformanceFromLogs is used get the performance of the workload
  40. // from pod logs. Currently, we support only performance reported in
  41. // time.Duration format.
  42. ExtractPerformanceFromLogs(logs string) (perf time.Duration, err error)
  43. }
  44. // NodePerfWorkloads is the collection of all node performance testing workloads.
  45. var NodePerfWorkloads = []NodePerfWorkload{npbISWorkload{}, npbEPWorkload{}, tfWideDeepWorkload{}}