Skip to content

Commit d326fca

Browse files
Merge step with pipeline crd (#454)
1 parent 5d7f171 commit d326fca

Some content is hidden

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

59 files changed

+1819
-3012
lines changed

PROJECT

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ resources:
5959
kind: Descheduling
6060
path: github.com/cobaltcore-dev/cortex/api/v1alpha1
6161
version: v1alpha1
62-
- api:
63-
crdVersion: v1
64-
controller: true
65-
domain: cortex
66-
group: cortex.cloud
67-
kind: Step
68-
path: github.com/cobaltcore-dev/cortex/api/v1alpha1
69-
version: v1alpha1
7062
- api:
7163
crdVersion: v1
7264
controller: true

Tiltfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ helm_repo(
3131
)
3232

3333
########### Dependency CRDs
34+
# Make sure the local cluster is running if you are running into startup issues here.
3435
url = 'https://raw.githubusercontent.com/cobaltcore-dev/openstack-hypervisor-operator/refs/heads/main/charts/openstack-hypervisor-operator/crds/hypervisor-crd.yaml'
3536
local('curl ' + url + ' | kubectl apply -f -')
3637

api/v1alpha1/decision_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type DecisionSpec struct {
4343

4444
type StepResult struct {
4545
// object reference to the scheduler step.
46-
StepRef corev1.ObjectReference `json:"stepRef"`
46+
StepName string `json:"stepName"`
4747
// Activations of the step for each host.
4848
Activations map[string]float64 `json:"activations"`
4949
}

api/v1alpha1/pipeline_types.go

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,58 @@ package v1alpha1
66
import (
77
corev1 "k8s.io/api/core/v1"
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9+
runtime "k8s.io/apimachinery/pkg/runtime"
910
)
1011

11-
type StepInPipeline struct {
12-
// Reference to the step.
13-
Ref corev1.ObjectReference `json:"ref"`
12+
type DisabledValidationsSpec struct {
13+
// Whether to validate that no subjects are removed or added from the scheduler
14+
// step. This should only be disabled for scheduler steps that remove subjects.
15+
// Thus, if no value is provided, the default is false.
16+
SameSubjectNumberInOut bool `json:"sameSubjectNumberInOut,omitempty"`
17+
// Whether to validate that, after running the step, there are remaining subjects.
18+
// This should only be disabled for scheduler steps that are expected to
19+
// remove all subjects.
20+
SomeSubjectsRemain bool `json:"someSubjectsRemain,omitempty"`
21+
}
22+
23+
type StepType string
24+
25+
const (
26+
// Step for assigning weights to hosts.
27+
StepTypeWeigher StepType = "weigher"
28+
// Step for filtering hosts.
29+
StepTypeFilter StepType = "filter"
30+
// Step for generating descheduling recommendations.
31+
StepTypeDescheduler StepType = "descheduler"
32+
)
33+
34+
type WeigherSpec struct {
35+
// The validations to disable for this step. If none are provided, all
36+
// applied validations are enabled.
37+
// +kubebuilder:validation:Optional
38+
DisabledValidations DisabledValidationsSpec `json:"disabledValidations,omitempty"`
39+
}
40+
41+
type StepSpec struct {
42+
// The type of the scheduler step.
43+
Type StepType `json:"type"`
44+
// If the type is "weigher", this contains additional configuration for it.
45+
// +kubebuilder:validation:Optional
46+
Weigher *WeigherSpec `json:"weigher,omitempty"`
47+
48+
// The name of the scheduler step in the cortex implementation.
49+
Impl string `json:"impl"`
50+
// Additional configuration for the extractor that can be used
51+
// +kubebuilder:validation:Optional
52+
Opts runtime.RawExtension `json:"opts,omitempty"`
53+
// Knowledges this step depends on to be ready.
54+
// +kubebuilder:validation:Optional
55+
Knowledges []corev1.ObjectReference `json:"knowledges,omitempty"`
56+
// Additional description of the step which helps understand its purpose
57+
// and decisions made by it.
58+
// +kubebuilder:validation:Optional
59+
Description string `json:"description,omitempty"`
60+
1461
// Whether this step is mandatory for the pipeline to be runnable.
1562
// +kubebuilder:default=true
1663
Mandatory bool `json:"mandatory"`
@@ -41,7 +88,7 @@ type PipelineSpec struct {
4188
// The type of the pipeline.
4289
Type PipelineType `json:"type"`
4390
// The ordered list of steps that make up this pipeline.
44-
Steps []StepInPipeline `json:"steps,omitempty"`
91+
Steps []StepSpec `json:"steps,omitempty"`
4592
}
4693

4794
const (

api/v1alpha1/step_types.go

Lines changed: 0 additions & 126 deletions
This file was deleted.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 4 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)