Documentation ¶
Index ¶
- func DetermineCloud(jobBase prowconfig.JobBase) string
- func DetermineTargetCluster(cluster, determinedCluster, defaultCluster string, canBeRelocated bool, ...) string
- func FindMostUsedCluster(jc *prowconfig.JobConfig) string
- func GetJobVolumesFromPrometheus(ctx context.Context, prometheusAPI PrometheusAPI, ts time.Time) (map[string]float64, error)
- func HasCapacityOrCapabilitiesChanged(prev, next ClusterMap) bool
- func ReadGob(filename string, data interface{}) error
- func SaveConfig(config *Config, configPath string) error
- func WriteGob(filename string, data interface{}) error
- type BuildFarmConfig
- type Client
- type ClusterInfo
- type ClusterMap
- type Config
- func (config *Config) DetermineCloudMapping(jobBase prowconfig.JobBase) string
- func (config *Config) DetermineClusterForJob(jobBase prowconfig.JobBase, path string, cm ClusterMap) (clusterName api.Cluster, mayBeRelocated bool, _ error)
- func (config *Config) GetBuildFarmSize() int
- func (config *Config) GetClusterForJob(jobBase prowconfig.JobBase, path string, cm ClusterMap) (api.Cluster, error)
- func (config *Config) IsInBuildFarm(clusterName api.Cluster) api.Cloud
- func (config *Config) MatchingPathRegEx(path string) bool
- func (config *Config) Validate() error
- type Group
- type JobGroups
- type PrometheusAPI
- type PrometheusOptions
- type Prowjobs
- type SchedulingRequest
- type SchedulingResponse
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetermineCloud ¶
func DetermineCloud(jobBase prowconfig.JobBase) string
DetermineCloud determines which cloud this job should run. It returns the value of ci-operator.openshift.io/cloud if it is none empty. The label is set by prow-gen for multistage tests. For template tests and hand-crafted tests, it returns the value of env. var. CLUSTER_TYPE from the job's spec.
func DetermineTargetCluster ¶
func FindMostUsedCluster ¶
func FindMostUsedCluster(jc *prowconfig.JobConfig) string
func GetJobVolumesFromPrometheus ¶
func GetJobVolumesFromPrometheus(ctx context.Context, prometheusAPI PrometheusAPI, ts time.Time) (map[string]float64, error)
GetJobVolumesFromPrometheus gets job volumes from a Prometheus server for the given time
func HasCapacityOrCapabilitiesChanged ¶
func HasCapacityOrCapabilitiesChanged(prev, next ClusterMap) bool
func SaveConfig ¶
SaveConfig saves config to a file
Types ¶
type BuildFarmConfig ¶
type ClusterInfo ¶
ClusterInfo holds the provider, capacity, and capabilities.
type ClusterMap ¶
type ClusterMap map[string]ClusterInfo
ClusterMap maps a cluster name to its corresponding ClusterInfo.
func LoadClusterConfig ¶
LoadClusterConfig loads cluster configuration from a YAML file, returning a ClusterMap and a set of blocked clusters.
type Config ¶
type Config struct { // the job will be run on the same cloud as the one for the e2e test DetermineE2EByJob bool `json:"determineE2EByJob,omitempty"` // the job will be run on the target cloud if it otherwise runs on the source cloud. // The field has effect only when DetermineE2EByJob is true. CloudMapping map[api.Cloud]api.Cloud `json:"cloudMapping,omitempty"` // the cluster cluster name if no other condition matches Default api.Cluster `json:"default"` // the cluster name for ssh bastion jobs SSHBastion api.Cluster `json:"sshBastion"` // the cluster names for kvm jobs KVM []api.Cluster `json:"kvm"` // the cluster names for no-builds jobs NoBuilds []api.Cluster `json:"noBuilds,omitempty"` // Groups maps a group of jobs to a cluster Groups JobGroups `json:"groups"` // BuildFarm maps groups of jobs to a cloud provider, like GCP BuildFarm map[api.Cloud]map[api.Cluster]*BuildFarmConfig `json:"buildFarm,omitempty"` // BuildFarmCloud maps sets of clusters to a cloud provider, like GCP BuildFarmCloud map[api.Cloud][]string `json:"-"` }
Config is the configuration file of this tools, which defines the cluster parameter for each Prow job, i.e., where it runs
func LoadConfig ¶
LoadConfig loads config from a file
func (*Config) DetermineCloudMapping ¶
func (config *Config) DetermineCloudMapping(jobBase prowconfig.JobBase) string
DetermineCloudMapping determines if for a given cloud there is a replacement to map, eg for cost saving reasons
func (*Config) DetermineClusterForJob ¶
func (config *Config) DetermineClusterForJob(jobBase prowconfig.JobBase, path string, cm ClusterMap) (clusterName api.Cluster, mayBeRelocated bool, _ error)
DetermineClusterForJob return the cluster for a prow job and if it can be relocated to a cluster in build farm
func (*Config) GetBuildFarmSize ¶
GetBuildFarmSize returns build farm size
func (*Config) GetClusterForJob ¶
func (config *Config) GetClusterForJob(jobBase prowconfig.JobBase, path string, cm ClusterMap) (api.Cluster, error)
GetClusterForJob returns a cluster for a prow job
func (*Config) IsInBuildFarm ¶
IsInBuildFarm returns the cloudProvider if the cluster is in the build farm; empty string otherwise.
func (*Config) MatchingPathRegEx ¶
MatchingPathRegEx returns true if the given path matches a path regular expression defined in a config's group
type Group ¶
type Group struct { // a list of job names Jobs []string `json:"jobs,omitempty"` // a list of regexes of the file paths Paths []string `json:"paths,omitempty"` PathREs []*regexp.Regexp `json:"-"` }
Group is a group of jobs
type PrometheusAPI ¶
type PrometheusAPI interface { // Query performs a query for the given time. Query(ctx context.Context, query string, ts time.Time, opts ...prometheusapi.Option) (model.Value, prometheusapi.Warnings, error) }
PrometheusAPI defines what we expect Prometheus to do in the package
type PrometheusOptions ¶
type PrometheusOptions struct { PrometheusURL string PrometheusUsername string PrometheusPasswordPath string PrometheusBearerTokenPath string }
PrometheusOptions exposes options used in contacting a Prometheus instance
func (*PrometheusOptions) AddFlags ¶
func (o *PrometheusOptions) AddFlags(fs *flag.FlagSet)
AddFlags sets up the flags for PrometheusOptions
func (*PrometheusOptions) NewPrometheusClient ¶
func (o *PrometheusOptions) NewPrometheusClient(secretGetter func(string) []byte) (api.Client, error)
NewPrometheusClient return a Prometheus client
func (*PrometheusOptions) Validate ¶
func (o *PrometheusOptions) Validate() error
Validate validates the values in the options
type Prowjobs ¶
type Prowjobs struct {
// contains filtered or unexported fields
}
func NewProwjobs ¶
func (*Prowjobs) GetDataCopy ¶
func (*Prowjobs) HasAnyOfClusters ¶
func (*Prowjobs) Regenerate ¶
type SchedulingRequest ¶
type SchedulingRequest struct {
Job string `json:"job"`
}
SchedulingRequest represents the incoming request structure
type SchedulingResponse ¶
type SchedulingResponse struct {
Cluster string `json:"cluster"`
}
Response represents the response structure
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) EventHandler ¶
func (s *Server) EventHandler(w http.ResponseWriter, r *http.Request)
EventHandler handles the /event route with dispatch logic
func (*Server) RequestHandler ¶
func (s *Server) RequestHandler(w http.ResponseWriter, r *http.Request)
RequestHandler handles scheduling requests for jobs