Skip to content

Commit dbf0ef8

Browse files
committed
Implementing pod and LLMServerPool controllers and
adjusting provider to sync via controller datastore
1 parent 9a7ac49 commit dbf0ef8

File tree

3 files changed

+0
-130
lines changed

3 files changed

+0
-130
lines changed

pkg/ext-proc/backend/k8s_client.go

-52
This file was deleted.

pkg/ext-proc/backend/provider.go

-32
Original file line numberDiff line numberDiff line change
@@ -80,35 +80,3 @@ func (p *Provider) Init(refreshPodsInterval, refreshMetricsInterval time.Duratio
8080

8181
return nil
8282
}
83-
84-
// refreshPodsOnce lists pods and updates keys in the podMetrics map.
85-
// Note this function doesn't update the PodMetrics value, it's done separately.
86-
func (p *Provider) refreshPodsOnce() error {
87-
pods, err := p.pl.List()
88-
if err != nil {
89-
return err
90-
}
91-
// merge new pods with cached ones.
92-
// add new pod to the map
93-
for pod := range pods {
94-
if _, ok := p.podMetrics.Load(pod); !ok {
95-
new := &PodMetrics{
96-
Pod: pod,
97-
Metrics: Metrics{
98-
ActiveModels: make(map[string]int),
99-
},
100-
}
101-
p.podMetrics.Store(pod, new)
102-
}
103-
}
104-
// remove pods that don't exist any more.
105-
mergeFn := func(k, v any) bool {
106-
pod := k.(Pod)
107-
if _, ok := pods[pod]; !ok {
108-
p.podMetrics.Delete(pod)
109-
}
110-
return true
111-
}
112-
p.podMetrics.Range(mergeFn)
113-
return nil
114-
}

pkg/ext-proc/main.go

-46
Original file line numberDiff line numberDiff line change
@@ -115,52 +115,6 @@ func main() {
115115
}
116116
}()
117117

118-
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientset, time.Second*30)
119-
llmServerPoolInformerFactory := informers.NewSharedInformerFactory(iGWClientSet, time.Second*30)
120-
121-
llmServerPoolController := backend.NewLLMServerPoolController(
122-
ctx,
123-
*serverPoolName,
124-
datastore,
125-
kubeClientset,
126-
llmServerPoolInformerFactory.Api().V1alpha1().LLMServerPools(),
127-
)
128-
129-
podController := backend.NewPodController(
130-
ctx,
131-
*serverPoolName,
132-
datastore,
133-
kubeClientset,
134-
kubeInformerFactory.Core().V1().Pods(),
135-
)
136-
137-
kubeInformerFactory.Start(ctx.Done())
138-
llmServerPoolInformerFactory.Start(ctx.Done())
139-
140-
errChan := make(chan error)
141-
go func() {
142-
if err = llmServerPoolController.Run(ctx, 1); err != nil {
143-
klog.Error(err, "Error running LLMServerPoolController")
144-
errChan <- err
145-
}
146-
}()
147-
148-
go func() {
149-
if err = podController.Run(ctx, 2); err != nil {
150-
klog.Error(err, "Error running PodController")
151-
errChan <- err
152-
}
153-
}()
154-
155-
k8sClient := backend.NewK8sClient("test-pool", "default", kubeClientset, iGWClientSet)
156-
serverPool, err := k8sClient.GetLLMServerPool()
157-
if err != nil {
158-
klog.Error(err.Error())
159-
} else if serverPool != nil {
160-
klog.Info(fmt.Printf("KELLEN TEST: %v", serverPool.Spec.ModelServerSelector.MatchLabels))
161-
} else {
162-
klog.Info("No err but serverPool is nil")
163-
}
164118
s := grpc.NewServer()
165119

166120
pp := backend.NewProvider(&backend.PodMetricsClientImpl{}, datastore)

0 commit comments

Comments
 (0)