Skip to content

refactor(rbg): add api v1alpha2#167

Merged
cheyang merged 2 commits intosgl-project:mainfrom
Syspretor:refactor/add-api-v1alpha2
Mar 2, 2026
Merged

refactor(rbg): add api v1alpha2#167
cheyang merged 2 commits intosgl-project:mainfrom
Syspretor:refactor/add-api-v1alpha2

Conversation

@Syspretor
Copy link
Copy Markdown
Collaborator

@Syspretor Syspretor commented Mar 2, 2026

Ref #166 Phase 1: Add RoleBasedGroup apiVersion v1alpha2

Ⅰ. Motivation

Ⅱ. Modifications

Phase 1: Add RoleBasedGroup apiVersion v1alpha2

1.1 Deprecate Workload Field

Goal: Simplify API by removing the burden of explicitly specifying workload type

  • Mark workload field as deprecated
  • Controller automatically infers workload type internally

1.2 Change Default Workload Type to InstanceSet

Goal: InstanceSet as the default and recommended workload type

  • v1alpha2 uses InstanceSet workload by default

1.3 Redefine Role Template Declaration for Standalone/Multi-node Topology

Goal: Use Pattern model to clearly distinguish standalone and multi-node deployment

Completed Work:

  • Introduce Pattern structure with standalonePattern and leaderWorkerPattern
  • TemplateSource encapsulates template and templateRef
  • TemplateRef encapsulates name and patch fields
  • Remove top-level template, templateRef, templatePatch fields from RoleSpec
  • Remove leaderWorkerSet field, replaced by leaderWorkerPattern

v1alpha2 RoleSpec New Structure:

roles:
  - name: worker
    replicas: 2
    standalonePattern:           # Standalone mode
      template: {}               # Or use templateRef
      # templateRef:
      #   name: "shared-template"
      #   patch: {}
    # Or
    leaderWorkerPattern:         # Multi-node mode (LeaderWorkerSet)
      size: 4
      template: {}
      leaderTemplatePatch: {}
      workerTemplatePatch: {}

1.4 Temporarily Remove PodGroupPolicy / CoordinationRequirements Fields

Goal: Decouple gang scheduling and coordination into independent CRDs

  • Remove podGroupPolicy field from v1alpha2 RoleBasedGroupSpec
  • Remove coordination field from v1alpha2 RoleBasedGroupSpec

1.5 Use v1alpha1 as Storage Version

Goal: Ensure backward compatibility and smooth transition

  • Mark v1alpha1 with +kubebuilder:storageversion
  • v1alpha2 does not set storageversion (served but not stored)

Ⅲ. Does this pull request fix one issue?

fixes #XXXX

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@Syspretor Syspretor requested a review from cheyang March 2, 2026 06:28
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Syspretor Syspretor force-pushed the refactor/add-api-v1alpha2 branch from 79d8714 to 0c09c46 Compare March 2, 2026 06:35
@Syspretor Syspretor force-pushed the refactor/add-api-v1alpha2 branch from 0c09c46 to 7f97d47 Compare March 2, 2026 06:41
Comment thread api/workloads/v1alpha1/rolebasedgroup_types.go
Comment thread api/workloads/v1alpha2/rolebasedgroup_conversion.go
@Syspretor Syspretor changed the title Refactor/add api v1alpha2 refactor(rbg): add api v1alpha2 Mar 2, 2026
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@cheyang cheyang merged commit b5e566c into sgl-project:main Mar 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants