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

Consolidate the Version constant #27

Merged
merged 1 commit into from
Dec 13, 2017
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
7 changes: 3 additions & 4 deletions gameservers/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"strings"
"time"

"github.com/agonio/agon/pkg"
"github.com/agonio/agon/pkg/client/clientset/versioned"
"github.com/agonio/agon/pkg/client/informers/externalversions"
"github.com/agonio/agon/pkg/signals"
Expand All @@ -32,9 +33,7 @@ import (
"k8s.io/client-go/rest"
)

// Version the release version of the gameserver controller
const (
Version = "0.1"
sidecarFlag = "sidecar"
pullSidecarFlag = "always-pull-sidecar"
)
Expand All @@ -45,7 +44,7 @@ func init() {

// main starts the operator for the gameserver CRD
func main() {
viper.SetDefault(sidecarFlag, "gcr.io/agon-images/gameservers-sidecar:"+Version)
viper.SetDefault(sidecarFlag, "gcr.io/agon-images/gameservers-sidecar:"+pkg.Version)
viper.SetDefault(pullSidecarFlag, false)

pflag.String(sidecarFlag, viper.GetString(sidecarFlag), "Flag to overwrite the GameServer sidecar image that is used. Can also use SIDECAR env variable")
Expand All @@ -62,7 +61,7 @@ func main() {

logrus.WithField(sidecarFlag, sidecarImage).
WithField("alwaysPullSidecarImage", alwaysPullSidecar).
WithField("Version", Version).Info("starting gameServer operator...")
WithField("Version", pkg.Version).Info("starting gameServer operator...")

config, err := rest.InClusterConfig()
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions gameservers/sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net"

"github.com/agonio/agon/gameservers/sidecar/sdk"
"github.com/agonio/agon/pkg"
"github.com/agonio/agon/pkg/util/runtime"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
Expand All @@ -29,9 +30,7 @@ import (
)

const (
// Version the release version of the sidecar
Version = "0.1"
port = 59357
port = 59357

// gameServerNameEnv is the environment variable for the Game Server name
gameServerNameEnv = "GAMESERVER_NAME"
Expand All @@ -58,7 +57,7 @@ func main() {

isLocal := viper.GetBool(localFlag)

logrus.WithField(localFlag, isLocal).WithField("version", Version).WithField("port", port).Info("Starting sdk sidecar")
logrus.WithField(localFlag, isLocal).WithField("version", pkg.Version).WithField("port", port).Info("Starting sdk sidecar")

lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", port))
if err != nil {
Expand Down
20 changes: 20 additions & 0 deletions pkg/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package pkg

const (
// Version is the global version for all binaries
Version = "0.1"
)