kruise-game
kruise-game copied to clipboard
Feat | Add AutoUpdateStrategy
Backgroud
Currently GameServerSet supports batch updates in a user-defined manner by setting UpdatePriority and Partition. However, under this strategy, users need to frequently operate gss and gs objects, and many times users want to complete rolling updates in a more automated way. There are currently two scenario requirements:
- The existing gs under gss is not updated, and the new gs is created with a new image. In this way, users can achieve hot updates of versions through the automatic scaling capabilities provided by OKG without additional manual intervention.
- User-specified gs update in certain states. gss will determine whether the gs is updated based on the current gs status. If it meets the user-specified status, it will be updated; otherwise, it will not be updated.
API
type UpdateStrategy struct {
// Type indicates the type of the StatefulSetUpdateStrategy.
// Default is RollingUpdate.
// +optional
Type apps.StatefulSetUpdateStrategyType `json:"type,omitempty"`
// RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
// +optional
RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty"`
// AutoUpdateStrategy means that the update process will be performed automatically without user intervention.
// +optional
AutoUpdateStrategy *AutoUpdateStrategy `json:"autoUpdateStrategy,omitempty"`
}
type AutoUpdateStrategy struct {
//+kubebuilder:validation:Required
Type AutoUpdateStrategyType `json:"type"`
// Only GameServers in SpecificStates will be updated.
// +optional
SpecificStates []OpsState `json:"specificStates,omitempty"`
}
type AutoUpdateStrategyType string
const (
// OnlyNewAutoUpdateStrategyType indicates exist GameServers will never be updated, new GameServers will be created in new template.
OnlyNewAutoUpdateStrategyType AutoUpdateStrategyType = "OnlyNew"
// SpecificStateAutoUpdateStrategyType indicates only GameServers with Specific OpsStates will be updated.
SpecificStateAutoUpdateStrategyType AutoUpdateStrategyType = "SpecificState"
)
@sFireFrog
Is that meet the requirement from https://github.com/openkruise/kruise-game/issues/111 ?
We implement it by a simpler way.
https://openkruise.io/kruisegame/best-practices/session-based-game/#game-room-hot-update