-
Notifications
You must be signed in to change notification settings - Fork 8
/
benchmark_types.go
132 lines (112 loc) · 4.52 KB
/
benchmark_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* Copyright 2022- IBM Inc. All rights reserved
* SPDX-License-Identifier: Apache2.0
*/
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
type BenchmarkOperatorMeta struct {
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
}
// BenchmarkSpec defines the desired state of Benchmark
type BenchmarkSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Operator BenchmarkOperatorMeta `json:"benchmarkOperator"`
Spec string `json:"benchmarkSpec"`
IterationSpec IterationSpec `json:"iterationSpec,omitempty"`
Repetition int `json:"repetition,omitempty"`
JobInterval int `json:"interval,omitempty"`
ParserKey string `json:"parserKey,omitempty"`
BuildConfigs []ConfigSpec `json:"trackBuildConfigs,omitempty"`
Sidecar bool `json:"sidecar,omitempty"`
}
// BuildConfig Definition
type ConfigSpec struct {
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
type IterationSpec struct {
Iteration []IterationItem `json:"iterations,omitempty"`
NodeSelection *NodeSelectionSpec `json:"nodeSelection,omitempty"`
Configuration []IterationItem `json:"configurations,omitempty"`
Sequential bool `json:"sequential,omitempty"`
Minimize bool `json:"minimize,omitempty"`
}
type NodeSelectionSpec struct {
Location string `json:"location"`
TunedValues []string `json:"values"`
TargetSelector *metav1.LabelSelector `json:"selector,omitempty"`
}
// Iteration Definition
type IterationItem struct {
Name string `json:"name"`
Location string `json:"location"`
Values []string `json:"values,omitempty"`
}
type BenchmarkResultItem struct {
Repetition string `json:"run"`
JobName string `json:"job"`
PodName string `json:"pod"`
PerformanceKey string `json:"performanceKey"`
PerformanceValue string `json:"performanceValue"`
Result string `json:"parseResult"`
PushedTime string `json:"pushedTime"`
}
// BemchmarkIterationHash
type IterationHash struct {
Hash string `json:"hash"`
Build string `json:"build"`
Iteration map[string]string `json:"iterations"`
Repetition string `json:"run"`
}
// BenchmarkPerformanceResult
type BenchmarkResult struct {
BuildID string `json:"build"`
IterationID string `json:"scenarioID"`
IterationMap map[string]string `json:"scenarios"`
ConfigurationID string `json:"configID"`
ConfigurationMap map[string]string `json:"configurations"`
Items []BenchmarkResultItem `json:"repetitions"`
}
type BenchmarkBestResult struct {
BuildID string `json:"build"`
IterationID string `json:"scenarioID"`
ConfigurationMap map[string]string `json:"configurations"`
PerformanceKey string `json:"performanceKey"`
PerformanceValue string `json:"performanceValue"`
}
// BenchmarkStatus defines the observed state of Benchmark
type BenchmarkStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Hash []IterationHash `json:"hash,omitempty"`
Results []BenchmarkResult `json:"results,omitempty"`
BestResults []BenchmarkBestResult `json:"bestResults,omitempty"`
TrackedBuilds []string `json:"builds,omitempty"`
JobCompleted string `json:"jobCompleted,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// Benchmark is the Schema for the benchmarks API
type Benchmark struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BenchmarkSpec `json:"spec,omitempty"`
Status BenchmarkStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// BenchmarkList contains a list of Benchmark
type BenchmarkList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Benchmark `json:"items"`
}
func init() {
SchemeBuilder.Register(&Benchmark{}, &BenchmarkList{})
}