Skip to content

Commit 1af9259

Browse files
committed
fix router service discovery label selector
1 parent dda8f68 commit 1af9259

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

internal/controller/arksdisaggregatedapplication_controller.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,14 +1649,24 @@ func (r *ArksDisaggregatedApplicationReconciler) generateDecodeWorkloadLwsLabels
16491649
return podLabels
16501650
}
16511651

1652+
func (r *ArksDisaggregatedApplicationReconciler) generateWorkloadSelectorLabels(application *arksv1.ArksDisaggregatedApplication, disaggregatedRole string) map[string]string {
1653+
podLabels := map[string]string{}
1654+
podLabels[arksv1.ArksControllerKeyDisaggregationRole] = disaggregatedRole
1655+
podLabels[arksv1.ArksControllerKeyApplication] = application.Name
1656+
podLabels[arksv1.ArksControllerKeyModel] = application.Spec.Model.Name
1657+
podLabels[arksv1.ArksControllerKeyWorkLoadRole] = arksv1.ArksWorkLoadRoleLeader
1658+
1659+
return podLabels
1660+
}
1661+
16521662
func (r *ArksDisaggregatedApplicationReconciler) generateDisaggregationRouterCommand(application *arksv1.ArksDisaggregatedApplication, port, metricPort int32) (string, error) {
16531663
var args string
16541664
switch getApplicationRuntime(application) {
16551665
case string(arksv1.ArksRuntimeSGLang):
16561666
args = fmt.Sprintf("python3 -m sglang_router.launch_router --pd-disaggregation --service-discovery --service-discovery-port 8080 --host 0.0.0.0 --port %d", port)
16571667
args = fmt.Sprintf("%s --service-discovery-namespace %s", args, application.Namespace)
16581668
args = fmt.Sprintf("%s --prefill-selector", args)
1659-
prefillLabels := r.generatePrefillWorkloadLwsLabels(application, arksv1.ArksWorkLoadRoleLeader)
1669+
prefillLabels := r.generateWorkloadSelectorLabels(application, "prefill")
16601670
prefillKeys := make([]string, 0, len(prefillLabels))
16611671
for key := range prefillLabels {
16621672
prefillKeys = append(prefillKeys, key)
@@ -1666,7 +1676,7 @@ func (r *ArksDisaggregatedApplicationReconciler) generateDisaggregationRouterCom
16661676
args = fmt.Sprintf("%s %s=%s", args, key, prefillLabels[key])
16671677
}
16681678
args = fmt.Sprintf("%s --decode-selector", args)
1669-
decodeLabels := r.generateDecodeWorkloadLwsLabels(application, arksv1.ArksWorkLoadRoleLeader)
1679+
decodeLabels := r.generateWorkloadSelectorLabels(application, "decode")
16701680
decodeKeys := make([]string, 0, len(decodeLabels))
16711681
for key := range decodeLabels {
16721682
decodeKeys = append(decodeKeys, key)

0 commit comments

Comments
 (0)