Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright SAP SE
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

// SchedulingDomain reflects the logical domain for scheduling.
type SchedulingDomain string

const (
// SchedulingDomainNova indicates scheduling related to the
// openstack Nova service, which is the compute service responsible for
// managing virtual machines in an openstack cloud infrastructure.
SchedulingDomainNova SchedulingDomain = "nova"
// SchedulingDomainCinder indicates scheduling related to the
// openstack Cinder service, which is the block storage service responsible
// for managing volumes in an openstack cloud infrastructure.
SchedulingDomainCinder SchedulingDomain = "cinder"
// SchedulingDomainManila indicates scheduling related to the openstack
// Manila service, which is the shared file system service responsible
// for managing shared file systems in an openstack cloud infrastructure.
SchedulingDomainManila SchedulingDomain = "manila"
// SchedulingDomainMachines indicates scheduling related to the ironcore
// machines, which are virtual machines managed by the ironcore platform.
SchedulingDomainMachines SchedulingDomain = "machines"
// SchedulingDomainPods indicates scheduling related to Kubernetes pods,
// which are the smallest deployable units in a Kubernetes cluster.
SchedulingDomainPods SchedulingDomain = "pods"
)
5 changes: 3 additions & 2 deletions api/v1alpha1/datasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ const (
)

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

// If given, configures a Prometheus datasource to fetch.
// Type must be set to "prometheus" if this is used.
Expand Down
25 changes: 3 additions & 22 deletions api/v1alpha1/decision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,10 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)

// The type of decision.
type DecisionType string

const (
// The decision was created by the nova external scheduler call.
// Usually we refer to this as nova initial placement, it also includes
// migrations or resizes.
DecisionTypeNovaServer DecisionType = "nova-server"
// The decision was created by the cinder external scheduler call.
DecisionTypeCinderVolume DecisionType = "cinder-volume"
// The decision was created by the manila external scheduler call.
DecisionTypeManilaShare DecisionType = "manila-share"
// The decision was created by spawning an ironcore machine.
DecisionTypeIroncoreMachine DecisionType = "ironcore-machine"
// The decision was created for a pod.
DecisionTypePod DecisionType = "pod"
)

type DecisionSpec struct {
// The operator by which this decision should be extracted.
Operator string `json:"operator,omitempty"`
// SchedulingDomain defines in which scheduling domain this decision
// was or is processed (e.g., nova, cinder, manila).
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`

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

// The type of decision, indicating what has initiated this decision.
Type DecisionType `json:"type"`
// If the type is "nova", this field contains the raw nova decision request.
// +kubebuilder:validation:Optional
NovaRaw *runtime.RawExtension `json:"novaRaw,omitempty"`
Expand Down
5 changes: 3 additions & 2 deletions api/v1alpha1/knowledge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ type KnowledgeExtractorSpec struct {
}

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

// The feature extractor to use for extracting this knowledge.
Extractor KnowledgeExtractorSpec `json:"extractor,omitempty"`
Expand Down
5 changes: 3 additions & 2 deletions api/v1alpha1/kpi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ type KPIDependenciesSpec struct {
}

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

// The name of the kpi in the cortex implementation.
Impl string `json:"impl"`
Expand Down
5 changes: 3 additions & 2 deletions api/v1alpha1/pipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ const (
)

type PipelineSpec struct {
// The operator by which this pipeline should be handled.
Operator string `json:"operator,omitempty"`
// SchedulingDomain defines in which scheduling domain this pipeline
// is used (e.g., nova, cinder, manila).
SchedulingDomain SchedulingDomain `json:"schedulingDomain"`
// An optional description of the pipeline.
// +kubebuilder:validation:Optional
Description string `json:"description,omitempty"`
Expand Down
5 changes: 3 additions & 2 deletions api/v1alpha1/step_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ type WeigherSpec struct {
}

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

// The type of the scheduler step.
Type StepType `json:"type"`
Expand Down
18 changes: 8 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ func main() {
}
// Inferred through the base controller.
decisionController.Client = multiclusterClient
decisionController.OperatorName = config.Operator
if err := (decisionController).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
os.Exit(1)
Expand All @@ -319,7 +318,6 @@ func main() {
}
// Inferred through the base controller.
deschedulingsController.Client = multiclusterClient
deschedulingsController.OperatorName = config.Operator
if err := (deschedulingsController).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DeschedulingsReconciler")
os.Exit(1)
Expand All @@ -341,7 +339,6 @@ func main() {
}
// Inferred through the base controller.
controller.Client = multiclusterClient
controller.OperatorName = config.Operator
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
os.Exit(1)
Expand All @@ -355,7 +352,6 @@ func main() {
}
// Inferred through the base controller.
controller.Client = multiclusterClient
controller.OperatorName = config.Operator
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
os.Exit(1)
Expand All @@ -369,7 +365,6 @@ func main() {
}
// Inferred through the base controller.
controller.Client = multiclusterClient
controller.OperatorName = config.Operator
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
os.Exit(1)
Expand All @@ -382,7 +377,6 @@ func main() {
}
// Inferred through the base controller.
controller.Client = multiclusterClient
controller.OperatorName = config.Operator
if err := (controller).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DecisionReconciler")
os.Exit(1)
Expand All @@ -392,8 +386,10 @@ func main() {
// Setup a controller which will reconcile the history and explanation for
// decision resources.
explanationController := &explanation.Controller{
Client: multiclusterClient,
OperatorName: config.Operator,
Client: multiclusterClient,
// The explanation controller is compatible with multiple scheduling
// domains.
SchedulingDomain: config.SchedulingDomain,
}
if err := explanationController.SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ExplanationController")
Expand Down Expand Up @@ -458,8 +454,10 @@ func main() {
}
if slices.Contains(config.EnabledControllers, "kpis-controller") {
if err := (&kpis.Controller{
Client: multiclusterClient,
OperatorName: config.Operator,
Client: multiclusterClient,
// The kpis controller is compatible with multiple scheduling
// domains.
SchedulingDomain: config.SchedulingDomain,
}).SetupWithManager(mgr, multiclusterClient); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "KPIController")
os.Exit(1)
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/cortex.cloud_datasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ spec:
- syncInterval
- type
type: object
operator:
description: The operator by which this datasource should be synced.
type: string
prometheus:
description: |-
If given, configures a Prometheus datasource to fetch.
Expand Down Expand Up @@ -250,6 +247,11 @@ spec:
- timeRange
- type
type: object
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this datasource
is used (e.g., nova, cinder, manila).
type: string
ssoSecretRef:
description: |-
Kubernetes secret ref for an optional sso certificate to access the host.
Expand All @@ -270,6 +272,7 @@ spec:
type: string
required:
- databaseSecretRef
- schedulingDomain
- type
type: object
status:
Expand Down
12 changes: 5 additions & 7 deletions config/crd/bases/cortex.cloud_decisions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ spec:
decision request.
type: object
x-kubernetes-preserve-unknown-fields: true
operator:
description: The operator by which this decision should be extracted.
type: string
pipelineRef:
description: |-
A reference to the pipeline that should be used for this decision.
Expand Down Expand Up @@ -221,14 +218,15 @@ spec:
For example, this can be the UUID of a nova instance or cinder volume.
This can be used to correlate multiple decisions for the same resource.
type: string
type:
description: The type of decision, indicating what has initiated this
decision.
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this decision
was or is processed (e.g., nova, cinder, manila).
type: string
required:
- pipelineRef
- resourceID
- type
- schedulingDomain
type: object
status:
description: status defines the observed state of Decision
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/cortex.cloud_knowledges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,20 @@ spec:
description: The name of the extractor.
type: string
type: object
operator:
description: The operator by which this knowledge should be extracted.
type: string
recency:
default: 60s
description: |-
The desired recency of this knowledge, i.e. how old it can be until
it needs to be re-extracted.
type: string
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this knowledge
is used (e.g., nova, cinder, manila).
type: string
required:
- recency
- schedulingDomain
type: object
status:
description: status defines the observed state of Knowledge
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/cortex.cloud_kpis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,19 @@ spec:
impl:
description: The name of the kpi in the cortex implementation.
type: string
operator:
description: The operator by which this kpi should be executed.
type: string
opts:
description: Additional configuration for the extractor that can be
used
type: object
x-kubernetes-preserve-unknown-fields: true
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this kpi
is used (e.g., nova, cinder, manila).
type: string
required:
- impl
- schedulingDomain
type: object
status:
description: status defines the observed state of KPI
Expand Down
7 changes: 5 additions & 2 deletions config/crd/bases/cortex.cloud_pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ spec:
description:
description: An optional description of the pipeline.
type: string
operator:
description: The operator by which this pipeline should be handled.
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this pipeline
is used (e.g., nova, cinder, manila).
type: string
steps:
description: The ordered list of steps that make up this pipeline.
Expand Down Expand Up @@ -128,6 +130,7 @@ spec:
description: The type of the pipeline.
type: string
required:
- schedulingDomain
- type
type: object
status:
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/cortex.cloud_steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: array
operator:
description: The operator by which this step should be executed.
type: string
opts:
description: Additional configuration for the extractor that can be
used
type: object
x-kubernetes-preserve-unknown-fields: true
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this step
is used (e.g., nova, cinder, manila).
type: string
type:
description: The type of the scheduler step.
type: string
Expand Down Expand Up @@ -146,6 +148,7 @@ spec:
type: object
required:
- impl
- schedulingDomain
- type
type: object
status:
Expand Down
9 changes: 6 additions & 3 deletions config/crd/cortex.cloud_datasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ spec:
- syncInterval
- type
type: object
operator:
description: The operator by which this datasource should be synced.
type: string
prometheus:
description: |-
If given, configures a Prometheus datasource to fetch.
Expand Down Expand Up @@ -250,6 +247,11 @@ spec:
- timeRange
- type
type: object
schedulingDomain:
description: |-
SchedulingDomain defines in which scheduling domain this datasource
is used (e.g., nova, cinder, manila).
type: string
ssoSecretRef:
description: |-
Kubernetes secret ref for an optional sso certificate to access the host.
Expand All @@ -270,6 +272,7 @@ spec:
type: string
required:
- databaseSecretRef
- schedulingDomain
- type
type: object
status:
Expand Down
Loading