Skip to content

Commit 866921a

Browse files
authored
Merge branch 'main' into refactor-capacity-kpis
2 parents 256029e + 26ccfbd commit 866921a

File tree

106 files changed

+861
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+861
-900
lines changed

api/v1alpha1/common_types.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright SAP SE
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
// SchedulingDomain reflects the logical domain for scheduling.
7+
type SchedulingDomain string
8+
9+
const (
10+
// SchedulingDomainNova indicates scheduling related to the
11+
// openstack Nova service, which is the compute service responsible for
12+
// managing virtual machines in an openstack cloud infrastructure.
13+
SchedulingDomainNova SchedulingDomain = "nova"
14+
// SchedulingDomainCinder indicates scheduling related to the
15+
// openstack Cinder service, which is the block storage service responsible
16+
// for managing volumes in an openstack cloud infrastructure.
17+
SchedulingDomainCinder SchedulingDomain = "cinder"
18+
// SchedulingDomainManila indicates scheduling related to the openstack
19+
// Manila service, which is the shared file system service responsible
20+
// for managing shared file systems in an openstack cloud infrastructure.
21+
SchedulingDomainManila SchedulingDomain = "manila"
22+
// SchedulingDomainMachines indicates scheduling related to the ironcore
23+
// machines, which are virtual machines managed by the ironcore platform.
24+
SchedulingDomainMachines SchedulingDomain = "machines"
25+
// SchedulingDomainPods indicates scheduling related to Kubernetes pods,
26+
// which are the smallest deployable units in a Kubernetes cluster.
27+
SchedulingDomainPods SchedulingDomain = "pods"
28+
)

api/v1alpha1/datasource_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ const (
193193
)
194194

195195
type DatasourceSpec struct {
196-
// The operator by which this datasource should be synced.
197-
Operator string `json:"operator,omitempty"`
196+
// SchedulingDomain defines in which scheduling domain this datasource
197+
// is used (e.g., nova, cinder, manila).
198+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
198199

199200
// If given, configures a Prometheus datasource to fetch.
200201
// Type must be set to "prometheus" if this is used.
@@ -242,7 +243,7 @@ type DatasourceStatus struct {
242243

243244
// The current status conditions of the datasource.
244245
// +kubebuilder:validation:Optional
245-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
246+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
246247
}
247248

248249
// Helper function to check if the datasource is ready.

api/v1alpha1/decision_types.go

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,10 @@ import (
99
runtime "k8s.io/apimachinery/pkg/runtime"
1010
)
1111

12-
// The type of decision.
13-
type DecisionType string
14-
15-
const (
16-
// The decision was created by the nova external scheduler call.
17-
// Usually we refer to this as nova initial placement, it also includes
18-
// migrations or resizes.
19-
DecisionTypeNovaServer DecisionType = "nova-server"
20-
// The decision was created by the cinder external scheduler call.
21-
DecisionTypeCinderVolume DecisionType = "cinder-volume"
22-
// The decision was created by the manila external scheduler call.
23-
DecisionTypeManilaShare DecisionType = "manila-share"
24-
// The decision was created by spawning an ironcore machine.
25-
DecisionTypeIroncoreMachine DecisionType = "ironcore-machine"
26-
// The decision was created for a pod.
27-
DecisionTypePod DecisionType = "pod"
28-
)
29-
3012
type DecisionSpec struct {
31-
// The operator by which this decision should be extracted.
32-
Operator string `json:"operator,omitempty"`
13+
// SchedulingDomain defines in which scheduling domain this decision
14+
// was or is processed (e.g., nova, cinder, manila).
15+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
3316

3417
// A reference to the pipeline that should be used for this decision.
3518
// This reference can be used to look up the pipeline definition and its
@@ -41,8 +24,6 @@ type DecisionSpec struct {
4124
// This can be used to correlate multiple decisions for the same resource.
4225
ResourceID string `json:"resourceID"`
4326

44-
// The type of decision, indicating what has initiated this decision.
45-
Type DecisionType `json:"type"`
4627
// If the type is "nova", this field contains the raw nova decision request.
4728
// +kubebuilder:validation:Optional
4829
NovaRaw *runtime.RawExtension `json:"novaRaw,omitempty"`
@@ -118,7 +99,7 @@ type DecisionStatus struct {
11899

119100
// The current status conditions of the decision.
120101
// +kubebuilder:validation:Optional
121-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
102+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
122103
}
123104

124105
// +kubebuilder:object:root=true

api/v1alpha1/descheduling_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type DeschedulingStatus struct {
6060
Phase DeschedulingStatusPhase `json:"phase"`
6161
// The current status conditions of the descheduling.
6262
// +kubebuilder:validation:Optional
63-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
63+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
6464
// The name of the compute host where the VM was rescheduled to.
6565
NewHost string `json:"newHost,omitempty"`
6666
// The type of host where the VM was rescheduled to.

api/v1alpha1/knowledge_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ type KnowledgeExtractorSpec struct {
3535
}
3636

3737
type KnowledgeSpec struct {
38-
// The operator by which this knowledge should be extracted.
39-
Operator string `json:"operator,omitempty"`
38+
// SchedulingDomain defines in which scheduling domain this knowledge
39+
// is used (e.g., nova, cinder, manila).
40+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
4041

4142
// The feature extractor to use for extracting this knowledge.
4243
Extractor KnowledgeExtractorSpec `json:"extractor,omitempty"`
@@ -105,7 +106,7 @@ type KnowledgeStatus struct {
105106

106107
// The current status conditions of the knowledge.
107108
// +kubebuilder:validation:Optional
108-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
109+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
109110
}
110111

111112
// Helper function to check if the knowledge is ready.

api/v1alpha1/kpi_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ type KPIDependenciesSpec struct {
2424
}
2525

2626
type KPISpec struct {
27-
// The operator by which this kpi should be executed.
28-
Operator string `json:"operator,omitempty"`
27+
// SchedulingDomain defines in which scheduling domain this kpi
28+
// is used (e.g., nova, cinder, manila).
29+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
2930

3031
// The name of the kpi in the cortex implementation.
3132
Impl string `json:"impl"`
@@ -60,7 +61,7 @@ type KPIStatus struct {
6061

6162
// The current status conditions of the kpi.
6263
// +kubebuilder:validation:Optional
63-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
64+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
6465
}
6566

6667
// +kubebuilder:object:root=true

api/v1alpha1/pipeline_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ const (
2828
)
2929

3030
type PipelineSpec struct {
31-
// The operator by which this pipeline should be handled.
32-
Operator string `json:"operator,omitempty"`
31+
// SchedulingDomain defines in which scheduling domain this pipeline
32+
// is used (e.g., nova, cinder, manila).
33+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
3334
// An optional description of the pipeline.
3435
// +kubebuilder:validation:Optional
3536
Description string `json:"description,omitempty"`
@@ -60,7 +61,7 @@ type PipelineStatus struct {
6061
StepsReadyFrac string `json:"stepsReadyFrac,omitempty"`
6162
// The current status conditions of the pipeline.
6263
// +kubebuilder:validation:Optional
63-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
64+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
6465
}
6566

6667
// +kubebuilder:object:root=true

api/v1alpha1/reservation_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type ReservationStatus struct {
6060
Phase ReservationStatusPhase `json:"phase,omitempty"`
6161
// The current status conditions of the reservation.
6262
// +kubebuilder:validation:Optional
63-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
63+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
6464
// The name of the compute host that was allocated.
6565
Host string `json:"host"`
6666
}

api/v1alpha1/step_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ type WeigherSpec struct {
3939
}
4040

4141
type StepSpec struct {
42-
// The operator by which this step should be executed.
43-
Operator string `json:"operator,omitempty"`
42+
// SchedulingDomain defines in which scheduling domain this step
43+
// is used (e.g., nova, cinder, manila).
44+
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
4445

4546
// The type of the scheduler step.
4647
Type StepType `json:"type"`
@@ -79,7 +80,7 @@ type StepStatus struct {
7980
KnowledgesReadyFrac string `json:"knowledgesReadyFrac,omitempty"`
8081
// The current status conditions of the step.
8182
// +kubebuilder:validation:Optional
82-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
83+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
8384
}
8485

8586
// +kubebuilder:object:root=true

cmd/main.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ func main() {
301301
}
302302
// Inferred through the base controller.
303303
decisionController.Client = multiclusterClient
304-
decisionController.OperatorName = config.Operator
305304
if err := (decisionController).SetupWithManager(mgr, multiclusterClient); err != nil {
306305
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
307306
os.Exit(1)
@@ -319,7 +318,6 @@ func main() {
319318
}
320319
// Inferred through the base controller.
321320
deschedulingsController.Client = multiclusterClient
322-
deschedulingsController.OperatorName = config.Operator
323321
if err := (deschedulingsController).SetupWithManager(mgr, multiclusterClient); err != nil {
324322
setupLog.Error(err, "unable to create controller", "controller", "DeschedulingsReconciler")
325323
os.Exit(1)
@@ -341,7 +339,6 @@ func main() {
341339
}
342340
// Inferred through the base controller.
343341
controller.Client = multiclusterClient
344-
controller.OperatorName = config.Operator
345342
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
346343
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
347344
os.Exit(1)
@@ -355,7 +352,6 @@ func main() {
355352
}
356353
// Inferred through the base controller.
357354
controller.Client = multiclusterClient
358-
controller.OperatorName = config.Operator
359355
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
360356
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
361357
os.Exit(1)
@@ -369,7 +365,6 @@ func main() {
369365
}
370366
// Inferred through the base controller.
371367
controller.Client = multiclusterClient
372-
controller.OperatorName = config.Operator
373368
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
374369
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
375370
os.Exit(1)
@@ -382,7 +377,6 @@ func main() {
382377
}
383378
// Inferred through the base controller.
384379
controller.Client = multiclusterClient
385-
controller.OperatorName = config.Operator
386380
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
387381
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
388382
os.Exit(1)
@@ -392,8 +386,10 @@ func main() {
392386
// Setup a controller which will reconcile the history and explanation for
393387
// decision resources.
394388
explanationController := &explanation.Controller{
395-
Client: multiclusterClient,
396-
OperatorName: config.Operator,
389+
Client: multiclusterClient,
390+
// The explanation controller is compatible with multiple scheduling
391+
// domains.
392+
SchedulingDomain: config.SchedulingDomain,
397393
}
398394
if err := explanationController.SetupWithManager(mgr, multiclusterClient); err != nil {
399395
setupLog.Error(err, "unable to create controller", "controller", "ExplanationController")
@@ -458,8 +454,10 @@ func main() {
458454
}
459455
if slices.Contains(config.EnabledControllers, "kpis-controller") {
460456
if err := (&kpis.Controller{
461-
Client: multiclusterClient,
462-
OperatorName: config.Operator,
457+
Client: multiclusterClient,
458+
// The kpis controller is compatible with multiple scheduling
459+
// domains.
460+
SchedulingDomain: config.SchedulingDomain,
463461
}).SetupWithManager(mgr, multiclusterClient); err != nil {
464462
setupLog.Error(err, "unable to create controller", "controller", "KPIController")
465463
os.Exit(1)

0 commit comments

Comments
 (0)