Skip to content

Commit e1732a9

Browse files
authored
Merge pull request #78 from nightmeng/bugfix/fix-router-label-selectors
fix router service discovery label selector
2 parents 191d8f6 + 1af9259 commit e1732a9

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
@@ -1617,14 +1617,24 @@ func (r *ArksDisaggregatedApplicationReconciler) generateDecodeWorkloadLwsLabels
16171617
return podLabels
16181618
}
16191619

1620+
func (r *ArksDisaggregatedApplicationReconciler) generateWorkloadSelectorLabels(application *arksv1.ArksDisaggregatedApplication, disaggregatedRole string) map[string]string {
1621+
podLabels := map[string]string{}
1622+
podLabels[arksv1.ArksControllerKeyDisaggregationRole] = disaggregatedRole
1623+
podLabels[arksv1.ArksControllerKeyApplication] = application.Name
1624+
podLabels[arksv1.ArksControllerKeyModel] = application.Spec.Model.Name
1625+
podLabels[arksv1.ArksControllerKeyWorkLoadRole] = arksv1.ArksWorkLoadRoleLeader
1626+
1627+
return podLabels
1628+
}
1629+
16201630
func (r *ArksDisaggregatedApplicationReconciler) generateDisaggregationRouterCommand(application *arksv1.ArksDisaggregatedApplication, port, metricPort int32) (string, error) {
16211631
var args string
16221632
switch getApplicationRuntime(application) {
16231633
case string(arksv1.ArksRuntimeSGLang):
16241634
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)
16251635
args = fmt.Sprintf("%s --service-discovery-namespace %s", args, application.Namespace)
16261636
args = fmt.Sprintf("%s --prefill-selector", args)
1627-
prefillLabels := r.generatePrefillWorkloadLwsLabels(application, arksv1.ArksWorkLoadRoleLeader)
1637+
prefillLabels := r.generateWorkloadSelectorLabels(application, "prefill")
16281638
prefillKeys := make([]string, 0, len(prefillLabels))
16291639
for key := range prefillLabels {
16301640
prefillKeys = append(prefillKeys, key)
@@ -1634,7 +1644,7 @@ func (r *ArksDisaggregatedApplicationReconciler) generateDisaggregationRouterCom
16341644
args = fmt.Sprintf("%s %s=%s", args, key, prefillLabels[key])
16351645
}
16361646
args = fmt.Sprintf("%s --decode-selector", args)
1637-
decodeLabels := r.generateDecodeWorkloadLwsLabels(application, arksv1.ArksWorkLoadRoleLeader)
1647+
decodeLabels := r.generateWorkloadSelectorLabels(application, "decode")
16381648
decodeKeys := make([]string, 0, len(decodeLabels))
16391649
for key := range decodeLabels {
16401650
decodeKeys = append(decodeKeys, key)

0 commit comments

Comments
 (0)