Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the filtering condition on GameServerShutdown to include the undeleted Unhealthy GSs #740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pkg/gameservers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,6 @@ func (c *Controller) syncGameServerCreatingState(gs *v1alpha1.GameServer) (*v1al

c.loggerForGameServer(gs).Info("Syncing Create State")

// Wait for pod cache sync, so that we don't end up with multiple pods for a GameServer
if !(cache.WaitForCacheSync(c.stop, c.podSynced)) {
return nil, errors.New("could not sync pod cache state")
}

// Maybe something went wrong, and the pod was created, but the state was never moved to Starting, so let's check
ret, err := c.listGameServerPods(gs)
if err != nil {
Expand Down Expand Up @@ -734,7 +729,8 @@ func (c *Controller) syncGameServerRequestReadyState(gs *v1alpha1.GameServer) (*

// syncGameServerShutdownState deletes the GameServer (and therefore the backing Pod) if it is in shutdown state
func (c *Controller) syncGameServerShutdownState(gs *v1alpha1.GameServer) error {
if !(gs.Status.State == v1alpha1.GameServerStateShutdown && gs.ObjectMeta.DeletionTimestamp.IsZero()) {
if !gs.ObjectMeta.DeletionTimestamp.IsZero() ||
(gs.Status.State != v1alpha1.GameServerStateShutdown && gs.Status.State != v1alpha1.GameServerStateUnhealthy) {
return nil
}

Expand Down
7 changes: 6 additions & 1 deletion test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
e2eframework "agones.dev/agones/test/e2e/framework"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -176,7 +177,11 @@ func TestUnhealthyGameServersWithoutFreePorts(t *testing.T) {
assert.Nil(t, err)

_, err = framework.WaitForGameServerState(newGs, v1alpha1.GameServerStateUnhealthy, 10*time.Second)
assert.Nil(t, err)
assert.NotNil(t, err)

_, err = gameServers.Get(newGs.Name, metav1.GetOptions{})
assert.NotNil(t, err)
assert.True(t, errors.IsNotFound(err))
}

func TestGameServerUnhealthyAfterDeletingPod(t *testing.T) {
Expand Down