Skip to content

[Bug] stateful roleinstance RevisionHistoryLimit is not limited by default #227

@JasonHe-WQ

Description

@JasonHe-WQ

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
  • 4. If the issue you raised is not a bug but a question, please raise a discussion at https://github.com/sgl-project/sglang/discussions/new/choose Otherwise, it will be closed.
  • 5. Please use English, otherwise it will be closed.

Describe the bug

Although the default RevisionHistoryLimit should be set to 10 by default, the limits would not be recoginzed as 10 if it was nil or not set, which means controller revions would not be truncated.

// RevisionHistoryLimit is the maximum number of revisions that will
// be maintained in the RoleInstanceSet's revision history. The revision history
// consists of all revisions not represented by a currently applied
// RoleInstanceSetSpec version. The default value is 10.
RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

// Check if RevisionHistoryLimit is set
if set.Spec.RevisionHistoryLimit == nil {
return nil
}

However, the stateless pattern is OK.

historyLen := len(noLiveRevisions)
historyLimit := 10
if set.Spec.RevisionHistoryLimit != nil {
historyLimit = int(*set.Spec.RevisionHistoryLimit)
}

Maybe, we can use kubebuilder's hints to cover.

	// RevisionHistoryLimit is the maximum number of revisions that will
	// be maintained in the RoleInstanceSet's revision history. The revision history
	// consists of all revisions not represented by a currently applied
	// RoleInstanceSetSpec version. The default value is 10.
	// +kubebuilder:default=10
	// +kubebuilder:validation:Minimum=0
	// +optional
	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`

Reproduction

use a RBG with roleinstance workload in stateful pattern

Environment

latest main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions