Checklist
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
Checklist
Describe the bug
Although the default
RevisionHistoryLimitshould 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.rbg/api/workloads/v1alpha2/roleinstanceset_types.go
Lines 67 to 71 in bd6296e
rbg/pkg/reconciler/roleinstanceset/statefulmode/stateful_instance_set_control.go
Lines 203 to 206 in 5c50dab
However, the stateless pattern is OK.
rbg/pkg/reconciler/roleinstanceset/statelessmode/reconciler.go
Lines 361 to 365 in bd6296e
Maybe, we can use kubebuilder's hints to cover.
Reproduction
use a RBG with roleinstance workload in stateful pattern
Environment
latest main