Skip to content

Commit

Permalink
feat: add GameServerConditions
Browse files Browse the repository at this point in the history
Signed-off-by: ChrisLiu <[email protected]>
  • Loading branch information
chrisliu1995 committed Sep 6, 2023
1 parent 3d523f9 commit c7fe7bc
Show file tree
Hide file tree
Showing 7 changed files with 1,181 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apis/v1alpha1/gameserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,39 @@ type GameServerStatus struct {
UpdatePriority *intstr.IntOrString `json:"updatePriority,omitempty"`
DeletionPriority *intstr.IntOrString `json:"deletionPriority,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// Conditions is an array of current observed GameServer conditions.
// +optional
Conditions []GameServerCondition `json:"conditions,omitempty" `
}

type GameServerCondition struct {
// Type is the type of the condition.
Type GameServerConditionType `json:"type"`
// Status is the status of the condition.
// Can be True, False, Unknown.
Status corev1.ConditionStatus `json:"status"`
// Last time we probed the condition.
// +optional
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// Unique, one-word, CamelCase reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty"`
}

type GameServerConditionType string

const (
NodeNormal GameServerConditionType = "NodeNormal"
PersistentVolumeNormal GameServerConditionType = "PersistentVolumeNormal"
PodNormal GameServerConditionType = "PodNormal"
)

type NetworkStatus struct {
NetworkType string `json:"networkType,omitempty"`
InternalAddresses []NetworkAddress `json:"internalAddresses,omitempty"`
Expand Down
34 changes: 34 additions & 0 deletions config/crd/bases/game.kruise.io_gameservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,40 @@ spec:
status:
description: GameServerStatus defines the observed state of GameServer
properties:
conditions:
description: Conditions is an array of current observed GameServer
conditions.
items:
properties:
lastProbeTime:
description: Last time we probed the condition.
format: date-time
type: string
lastTransitionTime:
description: Last time the condition transitioned from one status
to another.
format: date-time
type: string
message:
description: Human-readable message indicating details about
last transition.
type: string
reason:
description: Unique, one-word, CamelCase reason for the condition's
last transition.
type: string
status:
description: Status is the status of the condition. Can be True,
False, Unknown.
type: string
type:
description: Type is the type of the condition.
type: string
required:
- status
- type
type: object
type: array
currentState:
type: string
deletionPriority:
Expand Down
28 changes: 28 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,34 @@ rules:
- nodes/status
verbs:
- get
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims/status
verbs:
- get
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- persistentvolumes/status
verbs:
- get
- apiGroups:
- ""
resources:
Expand Down
Loading

0 comments on commit c7fe7bc

Please sign in to comment.