Skip to content

Commit 0162947

Browse files
jkowalskimarkmandel
authored andcommitted
extracted parts of pkg/gameservers that deal with SDK server into pkg/sdkserver
1 parent d4b1d10 commit 0162947

9 files changed

Lines changed: 22 additions & 24 deletions

File tree

cmd/sdk-server/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525

2626
"agones.dev/agones/pkg"
2727
"agones.dev/agones/pkg/client/clientset/versioned"
28-
"agones.dev/agones/pkg/gameservers"
2928
"agones.dev/agones/pkg/sdk"
29+
"agones.dev/agones/pkg/sdkserver"
3030
"agones.dev/agones/pkg/util/runtime"
3131
"agones.dev/agones/pkg/util/signals"
3232
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
@@ -108,8 +108,8 @@ func main() {
108108
logger.WithError(err).Fatalf("Could not create the agones api clientset")
109109
}
110110

111-
var s *gameservers.SDKServer
112-
s, err = gameservers.NewSDKServer(viper.GetString(gameServerNameEnv),
111+
var s *sdkserver.SDKServer
112+
s, err = sdkserver.NewSDKServer(viper.GetString(gameServerNameEnv),
113113
viper.GetString(podNamespaceEnv), kubeClient, agonesClient)
114114
if err != nil {
115115
logger.WithError(err).Fatalf("Could not start sidecar")
@@ -146,7 +146,7 @@ func registerLocal(grpcServer *grpc.Server, ctlConf config) error {
146146
}
147147
}
148148

149-
local, err := gameservers.NewLocalSDKServer(filePath)
149+
local, err := sdkserver.NewLocalSDKServer(filePath)
150150
if err != nil {
151151
return err
152152
}

pkg/gameservers/controller_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,3 +1106,14 @@ func newFakeController() (*Controller, agtesting.Mocks) {
11061106
c.recorder = m.FakeRecorder
11071107
return c, m
11081108
}
1109+
1110+
func newSingleContainerSpec() v1alpha1.GameServerSpec {
1111+
return v1alpha1.GameServerSpec{
1112+
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
1113+
Template: corev1.PodTemplateSpec{
1114+
Spec: corev1.PodSpec{
1115+
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
1116+
},
1117+
},
1118+
}
1119+
}
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"context"
@@ -22,27 +22,14 @@ import (
2222
"testing"
2323
"time"
2424

25-
"agones.dev/agones/pkg/apis/stable/v1alpha1"
2625
"agones.dev/agones/pkg/sdk"
2726
"github.com/sirupsen/logrus"
2827
"github.com/stretchr/testify/assert"
2928
netcontext "golang.org/x/net/context"
3029
"google.golang.org/grpc/metadata"
31-
corev1 "k8s.io/api/core/v1"
3230
"k8s.io/apimachinery/pkg/util/wait"
3331
)
3432

35-
func newSingleContainerSpec() v1alpha1.GameServerSpec {
36-
return v1alpha1.GameServerSpec{
37-
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
38-
Template: corev1.PodTemplateSpec{
39-
Spec: corev1.PodSpec{
40-
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
41-
},
42-
},
43-
}
44-
}
45-
4633
func testHTTPHealth(t *testing.T, url string, expectedResponse string, expectedStatus int) {
4734
// do a poll, because this code could run before the health check becomes live
4835
err := wait.PollImmediate(time.Second, 20*time.Second, func() (done bool, err error) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"io"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"encoding/json"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"agones.dev/agones/pkg/apis/stable/v1alpha1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"testing"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"io"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package gameservers
15+
package sdkserver
1616

1717
import (
1818
"net/http"

0 commit comments

Comments
 (0)