exec service quality action

Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
ChrisLiu 2022-09-21 16:46:05 +08:00
parent 97fef3ed2e
commit b6f41e5eab
1 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import (
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"strconv"
)
type Control interface {
@ -156,6 +157,9 @@ func (manager GameServerManager) SyncToGs(qualities []gameKruiseV1alpha1.Service
}
newGsConditions = append(newGsConditions, serviceQualityCondition)
if toExecAction {
if toExec == nil {
toExec = make(map[string]string)
}
toExec[string(pc.Type)] = string(pc.Status)
}
}
@ -163,9 +167,16 @@ func (manager GameServerManager) SyncToGs(qualities []gameKruiseV1alpha1.Service
if toExec != nil {
var spec gameKruiseV1alpha1.GameServerSpec
for _, sq := range qualities {
for name := range toExec {
for name, state := range toExec {
if sq.Name == name {
// TODO exec action
for _, action := range sq.ServiceQualityAction {
if state == strconv.FormatBool(action.State) {
spec.DeletionPriority = action.DeletionPriority
spec.UpdatePriority = action.UpdatePriority
spec.OpsState = action.OpsState
spec.NetworkDisabled = action.NetworkDisabled
}
}
}
}
}