exec service quality action
Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
parent
97fef3ed2e
commit
b6f41e5eab
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
"k8s.io/apimachinery/pkg/util/json"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Control interface {
|
type Control interface {
|
||||||
|
|
@ -156,6 +157,9 @@ func (manager GameServerManager) SyncToGs(qualities []gameKruiseV1alpha1.Service
|
||||||
}
|
}
|
||||||
newGsConditions = append(newGsConditions, serviceQualityCondition)
|
newGsConditions = append(newGsConditions, serviceQualityCondition)
|
||||||
if toExecAction {
|
if toExecAction {
|
||||||
|
if toExec == nil {
|
||||||
|
toExec = make(map[string]string)
|
||||||
|
}
|
||||||
toExec[string(pc.Type)] = string(pc.Status)
|
toExec[string(pc.Type)] = string(pc.Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -163,9 +167,16 @@ func (manager GameServerManager) SyncToGs(qualities []gameKruiseV1alpha1.Service
|
||||||
if toExec != nil {
|
if toExec != nil {
|
||||||
var spec gameKruiseV1alpha1.GameServerSpec
|
var spec gameKruiseV1alpha1.GameServerSpec
|
||||||
for _, sq := range qualities {
|
for _, sq := range qualities {
|
||||||
for name := range toExec {
|
for name, state := range toExec {
|
||||||
if sq.Name == name {
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue