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

Split pkg/gameservers into two #451

Merged
merged 1 commit into from
Dec 21, 2018
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: 4 additions & 4 deletions cmd/sdk-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"agones.dev/agones/pkg"
"agones.dev/agones/pkg/client/clientset/versioned"
"agones.dev/agones/pkg/gameservers"
"agones.dev/agones/pkg/sdk"
"agones.dev/agones/pkg/sdkserver"
"agones.dev/agones/pkg/util/runtime"
"agones.dev/agones/pkg/util/signals"
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down Expand Up @@ -108,8 +108,8 @@ func main() {
logger.WithError(err).Fatalf("Could not create the agones api clientset")
}

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

local, err := gameservers.NewLocalSDKServer(filePath)
local, err := sdkserver.NewLocalSDKServer(filePath)
if err != nil {
return err
}
Expand Down
11 changes: 11 additions & 0 deletions pkg/gameservers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,3 +1106,14 @@ func newFakeController() (*Controller, agtesting.Mocks) {
c.recorder = m.FakeRecorder
return c, m
}

func newSingleContainerSpec() v1alpha1.GameServerSpec {
return v1alpha1.GameServerSpec{
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
},
},
}
}
15 changes: 1 addition & 14 deletions pkg/gameservers/helper_test.go → pkg/sdkserver/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"context"
Expand All @@ -22,27 +22,14 @@ import (
"testing"
"time"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
"agones.dev/agones/pkg/sdk"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
netcontext "golang.org/x/net/context"
"google.golang.org/grpc/metadata"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/wait"
)

func newSingleContainerSpec() v1alpha1.GameServerSpec {
return v1alpha1.GameServerSpec{
Ports: []v1alpha1.GameServerPort{{ContainerPort: 7777, HostPort: 9999, PortPolicy: v1alpha1.Static}},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "container", Image: "container/image"}},
},
},
}
}

func testHTTPHealth(t *testing.T, url string, expectedResponse string, expectedStatus int) {
// do a poll, because this code could run before the health check becomes live
err := wait.PollImmediate(time.Second, 20*time.Second, func() (done bool, err error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/localsdk.go → pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/sdk.go → pkg/sdkserver/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"agones.dev/agones/pkg/apis/stable/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/sdk_test.go → pkg/sdkserver/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package gameservers
package sdkserver

import (
"net/http"
Expand Down