@@ -12,7 +12,6 @@ import (
1212 "time"
1313
1414 "github.com/cobaltcore-dev/cortex/api/delegation/pods"
15- podsv1alpha1 "github.com/cobaltcore-dev/cortex/api/delegation/pods/v1alpha1"
1615 "github.com/cobaltcore-dev/cortex/api/v1alpha1"
1716 "github.com/cobaltcore-dev/cortex/pkg/conf"
1817 "github.com/cobaltcore-dev/cortex/pkg/multicluster"
@@ -68,7 +67,7 @@ func (c *DecisionPipelineController) Reconcile(ctx context.Context, req ctrl.Req
6867 return ctrl.Result {}, nil
6968}
7069
71- func (c * DecisionPipelineController ) ProcessNewPod (ctx context.Context , pod * podsv1alpha1 .Pod ) error {
70+ func (c * DecisionPipelineController ) ProcessNewPod (ctx context.Context , pod * corev1 .Pod ) error {
7271 c .processMu .Lock ()
7372 defer c .processMu .Unlock ()
7473
@@ -122,7 +121,7 @@ func (c *DecisionPipelineController) process(ctx context.Context, decision *v1al
122121 }
123122
124123 // Find all available nodes.
125- nodes := & podsv1alpha1 .NodeList {}
124+ nodes := & corev1 .NodeList {}
126125 if err := c .List (ctx , nodes ); err != nil {
127126 return err
128127 }
@@ -142,7 +141,7 @@ func (c *DecisionPipelineController) process(ctx context.Context, decision *v1al
142141 log .Info ("decision processed successfully" , "duration" , time .Since (startedAt ))
143142
144143 // Set the node name on the pod.
145- pod := & podsv1alpha1 .Pod {}
144+ pod := & corev1 .Pod {}
146145 if err := c .Get (ctx , client.ObjectKey {
147146 Name : decision .Spec .PodRef .Name ,
148147 Namespace : decision .Spec .PodRef .Namespace ,
@@ -173,14 +172,14 @@ func (c *DecisionPipelineController) InitPipeline(
173172func (c * DecisionPipelineController ) handlePod () handler.EventHandler {
174173 return handler.Funcs {
175174 CreateFunc : func (ctx context.Context , evt event.CreateEvent , queue workqueue.TypedRateLimitingInterface [reconcile.Request ]) {
176- pod := evt .Object .(* podsv1alpha1 .Pod )
175+ pod := evt .Object .(* corev1 .Pod )
177176 if err := c .ProcessNewPod (ctx , pod ); err != nil {
178177 log := ctrl .LoggerFrom (ctx )
179178 log .Error (err , "failed to process new pod for scheduling" , "pod" , pod .Name )
180179 }
181180 },
182181 UpdateFunc : func (ctx context.Context , evt event.UpdateEvent , queue workqueue.TypedRateLimitingInterface [reconcile.Request ]) {
183- newPod := evt .ObjectNew .(* podsv1alpha1 .Pod )
182+ newPod := evt .ObjectNew .(* corev1 .Pod )
184183 if newPod .Spec .NodeName != "" {
185184 // Pod is already scheduled, no need to create a decision.
186185 return
@@ -193,7 +192,7 @@ func (c *DecisionPipelineController) handlePod() handler.EventHandler {
193192 DeleteFunc : func (ctx context.Context , evt event.DeleteEvent , queue workqueue.TypedRateLimitingInterface [reconcile.Request ]) {
194193 // Delete the associated decision(s).
195194 log := ctrl .LoggerFrom (ctx )
196- pod := evt .Object .(* podsv1alpha1 .Pod )
195+ pod := evt .Object .(* corev1 .Pod )
197196 var decisions v1alpha1.DecisionList
198197 if err := c .List (ctx , & decisions ); err != nil {
199198 log .Error (err , "failed to list decisions for deleted pod" )
@@ -217,11 +216,11 @@ func (c *DecisionPipelineController) SetupWithManager(mgr manager.Manager, mcl *
217216 }
218217 return multicluster .BuildController (mcl , mgr ).
219218 WatchesMulticluster (
220- & podsv1alpha1 .Pod {},
219+ & corev1 .Pod {},
221220 c .handlePod (),
222221 // Only schedule pods that have a custom scheduler set.
223222 predicate .NewPredicateFuncs (func (obj client.Object ) bool {
224- pod := obj .(* podsv1alpha1 .Pod )
223+ pod := obj .(* corev1 .Pod )
225224 if pod .Spec .NodeName != "" {
226225 // Skip pods that already have a node assigned.
227226 return false
0 commit comments