Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
20 changes: 19 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
analytics_settings(False)

# Use the ACTIVE_DEPLOYMENTS env var to select which Cortex bundles to deploy.
ACTIVE_DEPLOYMENTS_ENV = os.getenv('ACTIVE_DEPLOYMENTS', 'nova,manila,cinder,ironcore')
ACTIVE_DEPLOYMENTS_ENV = os.getenv('ACTIVE_DEPLOYMENTS', 'nova,manila,cinder,ironcore,pods')
if ACTIVE_DEPLOYMENTS_ENV == "":
ACTIVE_DEPLOYMENTS = [] # Catch "".split(",") = [""]
else:
Expand Down Expand Up @@ -49,6 +49,7 @@ bundle_charts = [
('helm/bundles/cortex-manila', 'cortex-manila'),
('helm/bundles/cortex-cinder', 'cortex-cinder'),
('helm/bundles/cortex-ironcore', 'cortex-ironcore'),
('helm/bundles/cortex-pods', 'cortex-pods'),
]
dep_charts = {
'cortex-crds': [
Expand All @@ -70,6 +71,10 @@ dep_charts = {
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
],
'cortex-pods': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
],
}

for (bundle_chart_path, bundle_chart_name) in bundle_charts:
Expand Down Expand Up @@ -106,6 +111,10 @@ k8s_yaml(helm('./helm/bundles/cortex-crds', name='cortex-crds', set=[
'cortex.rbac.ironcore.enable=true',
# Tilt is weird and thus we need to set this here even when its provided in the values.
'cortex.namePrefix=cortex-ironcore',

'cortex.crd.pods.enable=true',
'cortex.rbac.pods.enable=true',
'cortex.namePrefix=cortex-pods',
]))

if 'nova' in ACTIVE_DEPLOYMENTS:
Expand Down Expand Up @@ -171,6 +180,15 @@ if 'ironcore' in ACTIVE_DEPLOYMENTS:
k8s_yaml('samples/ironcore/machineclass.yaml')
k8s_yaml('samples/ironcore/machine.yaml')

if 'pods' in ACTIVE_DEPLOYMENTS:
print("Activating Cortex Pods bundle")
k8s_yaml(helm('./helm/bundles/cortex-pods', name='cortex-pods', values=tilt_values),)
k8s_resource('cortex-pods-controller-manager', labels=['Cortex-Pods'])
# Deploy example resources
k8s_yaml('samples/pods/node.yaml')
k8s_yaml('samples/pods/pod.yaml')
k8s_resource('test-pod', labels=['Cortex-Pods'])

########### Dev Dependencies
local('sh helm/sync.sh helm/dev/cortex-prometheus-operator')
k8s_yaml(helm('./helm/dev/cortex-prometheus-operator', name='cortex-prometheus-operator')) # Operator
Expand Down
33 changes: 33 additions & 0 deletions api/delegation/pods/messages.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2025 SAP SE
// SPDX-License-Identifier: Apache-2.0

package pods

import (
"log/slog"

corev1 "k8s.io/api/core/v1"
)

type PodPipelineRequest struct {
// The available nodes.
Nodes []corev1.Node `json:"nodes"`
}

func (r PodPipelineRequest) GetSubjects() []string {
hosts := make([]string, len(r.Nodes))
for i, host := range r.Nodes {
hosts[i] = host.Name
}
return hosts
}
func (r PodPipelineRequest) GetWeights() map[string]float64 {
weights := make(map[string]float64, len(r.Nodes))
for _, node := range r.Nodes {
weights[node.Name] = 0.0
}
return weights
}
func (r PodPipelineRequest) GetTraceLogArgs() []slog.Attr {
return []slog.Attr{}
}
5 changes: 5 additions & 0 deletions api/v1alpha1/decision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const (
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 {
Expand Down Expand Up @@ -53,6 +55,9 @@ type DecisionSpec struct {
// If the type is "machine", this field contains the machine reference.
// +kubebuilder:validation:Optional
MachineRef *corev1.ObjectReference `json:"machineRef,omitempty"`
// If the type is "pod", this field contains the pod reference.
// +kubebuilder:validation:Optional
PodRef *corev1.ObjectReference `json:"podRef,omitempty"`
}

type StepResult struct {
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
decisionsmachines "github.com/cobaltcore-dev/cortex/internal/scheduling/decisions/machines"
decisionsmanila "github.com/cobaltcore-dev/cortex/internal/scheduling/decisions/manila"
decisionsnova "github.com/cobaltcore-dev/cortex/internal/scheduling/decisions/nova"
decisionpods "github.com/cobaltcore-dev/cortex/internal/scheduling/decisions/pods"
deschedulingnova "github.com/cobaltcore-dev/cortex/internal/scheduling/descheduling/nova"
cindere2e "github.com/cobaltcore-dev/cortex/internal/scheduling/e2e/cinder"
manilae2e "github.com/cobaltcore-dev/cortex/internal/scheduling/e2e/manila"
Expand Down Expand Up @@ -372,6 +373,19 @@ func main() {
os.Exit(1)
}
}
if slices.Contains(config.EnabledControllers, "pods-decisions-pipeline-controller") {
controller := &decisionpods.DecisionPipelineController{
Monitor: pipelineMonitor,
Conf: config,
}
// 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)
}
}
if slices.Contains(config.EnabledControllers, "explanation-controller") {
// Setup a controller which will reconcile the history and explanation for
// decision resources.
Expand Down
43 changes: 43 additions & 0 deletions config/crd/bases/cortex.cloud_decisions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,49 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
podRef:
description: If the type is "pod", this field contains the pod reference.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: |-
If referring to a piece of an object instead of an entire object, this string
should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within a pod, this would take on a value like:
"spec.containers{name}" (where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]" (container with
index 2 in this pod). This syntax is chosen only to have some well-defined way of
referencing a part of an object.
type: string
kind:
description: |-
Kind of the referent.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
namespace:
description: |-
Namespace of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
type: string
resourceVersion:
description: |-
Specific resourceVersion to which this reference is made, if any.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
type: string
uid:
description: |-
UID of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
type: string
type: object
x-kubernetes-map-type: atomic
resourceID:
description: |-
An identifier for the underlying resource to be scheduled.
Expand Down
Loading
Loading