Skip to content

Commit

Permalink
release 1.6.0-rc.1 changes (#1510)
Browse files Browse the repository at this point in the history
* Default values of configs (#1508)

* setting validation and default values of configs

* config check in internal/config package

* Add open-match-override setting (#1490)

* Add open-match-override setting

* Added enabled

Co-authored-by: Jon Foust <[email protected]>
Co-authored-by: Mridul Goswami <[email protected]>

* shifted e2e tests to project root (#1481)

* release 1.6.0-rc.1 changes

* release changes for tutorials

* remaining changes

Co-authored-by: kemurayama <[email protected]>
Co-authored-by: Jon Foust <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2022
1 parent 1e51ad8 commit 4b8761a
Show file tree
Hide file tree
Showing 55 changed files with 149 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# If you want information on how to edit this file checkout,
# http://makefiletutorial.com/

BASE_VERSION = 0.0.0-dev
BASE_VERSION = 1.6.0-rc.1
SHORT_SHA = $(shell git rev-parse --short=7 HEAD | tr -d [:punct:])
BRANCH_NAME = $(shell git rev-parse --abbrev-ref HEAD | tr -d [:punct:])
VERSION = $(BASE_VERSION)-$(SHORT_SHA)
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ artifacts:
- install/yaml/06-open-match-override-configmap.yaml

substitutions:
_OM_VERSION: "0.0.0-dev"
_OM_VERSION: "1.6.0-rc.1"
_GCB_POST_SUBMIT: "0"
_GCB_LATEST_VERSION: "undefined"
_ARTIFACTS_BUCKET: "gs://open-match-build-artifacts/output/"
Expand Down
4 changes: 2 additions & 2 deletions install/helm/open-match/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

apiVersion: v2
appVersion: "0.0.0-dev"
version: 0.0.0-dev
appVersion: "1.6.0-rc.1"
version: 1.6.0-rc.1
name: open-match
dependencies:
- name: redis
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.

{{- if index .Values "open-match-override" }}
{{- if index .Values "open-match-override" "enabled" }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
2 changes: 1 addition & 1 deletion install/helm/open-match/templates/tests/om-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:
command: ["go"]
args:
- "test"
- "./internal/testing/e2e"
- "./testing/e2e"
- "-v"
- "-timeout"
- "150s"
Expand Down
6 changes: 5 additions & 1 deletion install/helm/open-match/values-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ open-match-customize:
# function:
# image: [YOUR_MMF_IMAGE]

# Controls if users need to install open-match-override ConfigMap.
open-match-override:
enabled: false

# Global configurations that are visible to all subcharts
global:
kubernetes:
Expand Down Expand Up @@ -292,7 +296,7 @@ global:
# Use this field if you need to override the image registry and image tag for all services defined in this chart
image:
registry: gcr.io/open-match-public-images
tag: 0.0.0-dev
tag: 1.6.0-rc.1
pullPolicy: Always

# Expose the telemetry configurations to all subcharts because prometheus, for example,
Expand Down
6 changes: 5 additions & 1 deletion install/helm/open-match/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ open-match-customize:
# function:
# image: [YOUR_MMF_IMAGE]

# Controls if users need to install open-match-override ConfigMap.
open-match-override:
enabled: false

# Global configurations that are visible to all subcharts
global:
kubernetes:
Expand Down Expand Up @@ -290,7 +294,7 @@ global:
# Use this field if you need to override the image registry and image tag for all services defined in this chart
image:
registry: gcr.io/open-match-public-images
tag: 0.0.0-dev
tag: 1.6.0-rc.1
pullPolicy: Always

# Expose the telemetry configurations to all subcharts because prometheus, for example,
Expand Down
24 changes: 24 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ func Read() (*viper.Viper, error) {
return nil, fmt.Errorf("fatal error reading override config file, desc: %s", err.Error())
}

if !cfg.IsSet("registrationInterval") {
log.Printf("config: registrationInterval is not set in matchmaker_config_override.yaml")
}

if !cfg.IsSet("proposalCollectionInterval") {
log.Printf("config: proposalCollectionInterval is not set in matchmaker_config_override.yaml")
}

if !cfg.IsSet("pendingReleaseTimeout") {
log.Printf("config: pendingReleaseTimeout is not set in matchmaker_config_override.yaml")
}

if !cfg.IsSet("assignedDeleteTimeout") {
log.Printf("config: assignedDeleteTimeout is not set in matchmaker_config_override.yaml")
}

if !cfg.IsSet("queryPageSize") {
log.Printf("config: queryPageSize is not set in matchmaker_config_override.yaml")
}

if !cfg.IsSet("backfillLockTimeout") {
log.Printf("config: backfillLockTimeout is not set in matchmaker_config_override.yaml")
}

// Look for updates to the config; in Kubernetes, this is implemented using
// a ConfigMap that is written to the matchmaker_config_override.yaml file, which is
// what the Open Match components using Viper monitor for changes.
Expand Down
2 changes: 1 addition & 1 deletion internal/rpc/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
"google.golang.org/grpc"
"open-match.dev/open-match/internal/config"
"open-match.dev/open-match/internal/telemetry"
shellTesting "open-match.dev/open-match/internal/testing"
utilTesting "open-match.dev/open-match/internal/util/testing"
"open-match.dev/open-match/pkg/pb"
shellTesting "open-match.dev/open-match/testing"
certgenTesting "open-match.dev/open-match/tools/certgen/testing"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/rpc/insecure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/stretchr/testify/require"
"google.golang.org/grpc"
shellTesting "open-match.dev/open-match/internal/testing"
shellTesting "open-match.dev/open-match/testing"
)

func TestInsecureStartStop(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/rpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"open-match.dev/open-match/internal/telemetry"
shellTesting "open-match.dev/open-match/internal/testing"
utilTesting "open-match.dev/open-match/internal/util/testing"
"open-match.dev/open-match/pkg/pb"
shellTesting "open-match.dev/open-match/testing"
)

func TestStartStopServer(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/rpc/tls_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
shellTesting "open-match.dev/open-match/internal/testing"
"open-match.dev/open-match/pkg/pb"
shellTesting "open-match.dev/open-match/testing"
certgenTesting "open-match.dev/open-match/tools/certgen/testing"
)

Expand Down
25 changes: 20 additions & 5 deletions internal/statestore/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (rb *redisBackend) UpdateBackfill(ctx context.Context, backfill *pb.Backfil
}
defer handleConnectionClose(&redisConn)

expired, err := isBackfillExpired(redisConn, backfill.Id, getBackfillReleaseTimeout(rb.cfg))
expired, err := isBackfillExpired(redisConn, backfill.Id, getBackfillReleaseTimeoutFraction(rb.cfg))
if err != nil {
return err
}
Expand Down Expand Up @@ -332,7 +332,7 @@ func (rb *redisBackend) UpdateAcknowledgmentTimestamp(ctx context.Context, id st
}
defer handleConnectionClose(&redisConn)

expired, err := isBackfillExpired(redisConn, id, getBackfillReleaseTimeout(rb.cfg))
expired, err := isBackfillExpired(redisConn, id, getBackfillReleaseTimeoutFraction(rb.cfg))
if err != nil {
return err
}
Expand Down Expand Up @@ -364,7 +364,7 @@ func (rb *redisBackend) GetExpiredBackfillIDs(ctx context.Context) ([]string, er
}
defer handleConnectionClose(&redisConn)

ttl := getBackfillReleaseTimeout(rb.cfg)
ttl := getBackfillReleaseTimeoutFraction(rb.cfg)
curTime := time.Now()
endTimeInt := curTime.Add(-ttl).UnixNano()
startTimeInt := 0
Expand Down Expand Up @@ -431,7 +431,7 @@ func (rb *redisBackend) GetIndexedBackfills(ctx context.Context) (map[string]int
}
defer handleConnectionClose(&redisConn)

ttl := getBackfillReleaseTimeout(rb.cfg)
ttl := getBackfillReleaseTimeoutFraction(rb.cfg)
curTime := time.Now()
endTimeInt := curTime.Add(time.Hour).UnixNano()
startTimeInt := curTime.Add(-ttl).UnixNano()
Expand Down Expand Up @@ -463,7 +463,22 @@ func (rb *redisBackend) GetIndexedBackfills(ctx context.Context) (map[string]int
}

func getBackfillReleaseTimeout(cfg config.View) time.Duration {
const (
name = "pendingReleaseTimeout"
// Default timeout to release backfill. This value
// will be used if pendingReleaseTimeout is not configured.
defaultpendingReleaseTimeout time.Duration = 1 * time.Minute
)

if !cfg.IsSet(name) {
return defaultpendingReleaseTimeout
}

return cfg.GetDuration(name)
}

func getBackfillReleaseTimeoutFraction(cfg config.View) time.Duration {
// Use a fraction 80% of pendingRelease Tickets TTL
ttl := cfg.GetDuration("pendingReleaseTimeout") / 5 * 4
ttl := getBackfillReleaseTimeout(cfg) / 5 * 4
return ttl
}
19 changes: 17 additions & 2 deletions internal/statestore/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ var (

// NewMutex returns a new distributed mutex with given name
func (rb *redisBackend) NewMutex(key string) RedisLocker {
m := redsync.NewMutex(fmt.Sprintf("lock/%s", key), rs.WithExpiry(rb.cfg.GetDuration("backfillLockTimeout")))
m := redsync.NewMutex(fmt.Sprintf("lock/%s", key), rs.WithExpiry(getBackfillLockTimeout(rb.cfg)))
return redisBackend{mutex: m}
}

//Lock locks r. In case it returns an error on failure, you may retry to acquire the lock by calling this method again.
// Lock locks r. In case it returns an error on failure, you may retry to acquire the lock by calling this method again.
func (rb redisBackend) Lock(ctx context.Context) error {
return rb.mutex.LockContext(ctx)
}
Expand Down Expand Up @@ -246,3 +246,18 @@ func handleConnectionClose(conn *redis.Conn) {
}).Debug("failed to close redis client connection.")
}
}

func getBackfillLockTimeout(cfg config.View) time.Duration {
const (
name = "backfillLockTimeout"
// Default timeout to lock backfill. This value
// will be used if backfillLockTimeout is not configured.
defaultBackfillLockTimeout time.Duration = 1 * time.Minute
)

if !cfg.IsSet(name) {
return defaultBackfillLockTimeout
}

return cfg.GetDuration(name)
}
2 changes: 1 addition & 1 deletion internal/statestore/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (rb *redisBackend) GetIndexedIDSet(ctx context.Context) (map[string]struct{
}
defer handleConnectionClose(&redisConn)

ttl := rb.cfg.GetDuration("pendingReleaseTimeout")
ttl := getBackfillReleaseTimeout(rb.cfg)
curTime := time.Now()
endTimeInt := curTime.Add(time.Hour).UnixNano()
startTimeInt := curTime.Add(-ttl).UnixNano()
Expand Down
4 changes: 2 additions & 2 deletions internal/testing/e2e/README.md → testing/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ of running the tests in a realistic setting where requests may not be routed to
For a new test package under test/e2e/ do the following:

Copy the contents of internal/testing/e2e/main_test.go and change the package name and add
the `open-match.dev/open-match/internal/testing/e2e` import.
the `open-match.dev/open-match/testing/e2e` import.

Example (may be out of date):
```golang
Expand All @@ -39,7 +39,7 @@ Example (may be out of date):
package tickets

import (
"open-match.dev/open-match/internal/testing/e2e"
"open-match.dev/open-match/testing/e2e"
"testing"
)

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion internal/testing/e2e/cluster.go → testing/e2e/cluster.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2ecluster
// +build e2ecluster

// Copyright 2019 Google LLC
Expand Down Expand Up @@ -25,7 +26,7 @@ import (
"open-match.dev/open-match/internal/app/evaluator"
"open-match.dev/open-match/internal/config"
"open-match.dev/open-match/internal/statestore"
mmfService "open-match.dev/open-match/internal/testing/mmf"
mmfService "open-match.dev/open-match/testing/mmf"
)

func start(t *testing.T, eval evaluator.Evaluator, mmf mmfService.MatchFunction) (config.View, func(time.Duration)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2ecluster
// +build e2ecluster

// Copyright 2019 Google LLC
Expand Down Expand Up @@ -32,8 +33,8 @@ import (
"open-match.dev/open-match/internal/app/evaluator"
"open-match.dev/open-match/internal/appmain/apptest"
"open-match.dev/open-match/internal/config"
mmfService "open-match.dev/open-match/internal/testing/mmf"
"open-match.dev/open-match/pkg/pb"
mmfService "open-match.dev/open-match/testing/mmf"
)

func TestServiceHealth(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/testing/e2e/common.go → testing/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"open-match.dev/open-match/internal/app/evaluator"
"open-match.dev/open-match/internal/appmain/apptest"
"open-match.dev/open-match/internal/config"
mmfService "open-match.dev/open-match/internal/testing/mmf"
"open-match.dev/open-match/pkg/pb"
mmfService "open-match.dev/open-match/testing/mmf"
)

var (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !e2ecluster
// +build !e2ecluster

// Copyright 2019 Google LLC
Expand Down Expand Up @@ -31,7 +32,7 @@ import (
"open-match.dev/open-match/internal/config"
"open-match.dev/open-match/internal/rpc"
"open-match.dev/open-match/internal/telemetry"
mmfService "open-match.dev/open-match/internal/testing/mmf"
mmfService "open-match.dev/open-match/testing/mmf"
)

func start(t *testing.T, eval evaluator.Evaluator, mmf mmfService.MatchFunction) (config.View, func(time.Duration)) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions third_party/swaggerui/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"urls": [
{"name": "Frontend", "url": "https://open-match.dev/api/v0.0.0-dev/frontend.swagger.json"},
{"name": "Backend", "url": "https://open-match.dev/api/v0.0.0-dev/backend.swagger.json"},
{"name": "Query", "url": "https://open-match.dev/api/v0.0.0-dev/query.swagger.json"},
{"name": "MatchFunction", "url": "https://open-match.dev/api/v0.0.0-dev/matchfunction.swagger.json"},
{"name": "Synchronizer", "url": "https://open-match.dev/api/v0.0.0-dev/synchronizer.swagger.json"},
{"name": "Evaluator", "url": "https://open-match.dev/api/v0.0.0-dev/evaluator.swagger.json"}
{"name": "Frontend", "url": "https://open-match.dev/api/v1.6.0-rc.1/frontend.swagger.json"},
{"name": "Backend", "url": "https://open-match.dev/api/v1.6.0-rc.1/backend.swagger.json"},
{"name": "Query", "url": "https://open-match.dev/api/v1.6.0-rc.1/query.swagger.json"},
{"name": "MatchFunction", "url": "https://open-match.dev/api/v1.6.0-rc.1/matchfunction.swagger.json"},
{"name": "Synchronizer", "url": "https://open-match.dev/api/v1.6.0-rc.1/synchronizer.swagger.json"},
{"name": "Evaluator", "url": "https://open-match.dev/api/v1.6.0-rc.1/evaluator.swagger.json"}
]
}
2 changes: 2 additions & 0 deletions tutorials/custom_evaluator/director/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR /app
ENV GO111MODULE=on

COPY . .
RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o director .

CMD ["/app/director"]
2 changes: 2 additions & 0 deletions tutorials/custom_evaluator/evaluator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR /app
ENV GO111MODULE=on

COPY . .
RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o evaluator .

CMD ["/app/evaluator"]
2 changes: 2 additions & 0 deletions tutorials/custom_evaluator/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR /app
ENV GO111MODULE=on

COPY . .
RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o frontend .

CMD ["/app/frontend"]
2 changes: 2 additions & 0 deletions tutorials/custom_evaluator/matchfunction/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR /app
ENV GO111MODULE=on

COPY . .
RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o matchfunction .

CMD ["/app/matchfunction"]
2 changes: 2 additions & 0 deletions tutorials/custom_evaluator/solution/director/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ WORKDIR /app
ENV GO111MODULE=on

COPY . .
RUN go mod edit -replace open-match.dev/[email protected]=open-match.dev/[email protected]
RUN go mod tidy
RUN go build -o director .

CMD ["/app/director"]
Loading

0 comments on commit 4b8761a

Please sign in to comment.