Skip to content

Commit

Permalink
Merge branch 'main' into implements-pdb
Browse files Browse the repository at this point in the history
  • Loading branch information
roberthbailey authored Sep 30, 2022
2 parents 807468d + acf760b commit f1df1bd
Show file tree
Hide file tree
Showing 81 changed files with 275 additions and 1,287 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/kubernetes_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ List of items to do for upgrading to {version}:
- [ ] Regenerate crd api reference docs - `make gen-api-docs`
- [ ] Regenerate Kubernetes resource includes (e.g. ObjectMeta, PodTemplateSpec)
- [ ] Start a cluster with `make gcloud-test-cluster`, uninstall agones using `helm uninstall agones -n agones-system`, and then run `make gen-embedded-openapi` and `make gen-install`
- [ ] If client-go pulled in a new version of gRPC, then also
- [ ] Update the SDK [base image grpc version](https://github.com/googleforgames/agones/blob/main/build/includes/sdk.mk#L30) and rebuild the image. Note that this can take a while and in the past we have had to manually push it to gcr because cloud build doesn't like how long it takes.
- [ ] Regenerate allocated API endpoints: [make gen-allocation-grpc](https://github.com/googleforgames/agones/blob/main/build/includes/allocation.mk#L55)
- [ ] Regenerate all client sdks: [make gen-all-sdk-grpc](https://github.com/googleforgames/agones/blob/main/build/README.md#make-gen-all-sdk-grpc)
- [ ] Update the version number in C++ Cmake scripts [here](https://github.com/googleforgames/agones/blob/main/sdks/cpp/CMakeLists.txt#L100) and [here](https://github.com/googleforgames/agones/blob/main/sdks/cpp/cmake/prerequisites.cmake#L34)
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ linters-settings:
rangeValCopy:
sizeThreshold: 512
skipTestFuncs: true
revive:
confidence: 0.8

issues:
# This turns off the default excludes - which was causing the linter
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ KIND_PROFILE ?= agones
KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane

# Game Server image to use while doing end-to-end tests
GS_TEST_IMAGE ?= gcr.io/agones-images/simple-game-server:0.13
GS_TEST_IMAGE ?= gcr.io/agones-images/simple-game-server:0.14

ALPHA_FEATURE_GATES ?= "PlayerTracking=true&PlayerAllocationFilter=true&SDKGracefulTermination=true&ResetMetricsOnDelete=true"

Expand Down
8 changes: 6 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Table of Contents
* [Building on Different Platforms](#building-on-different-platforms)
* [Linux](#linux)
* [Windows](#windows)
* [macOS](#macos)
* [macOS](#macos)
* [Testing and Building](#testing-and-building)
* [Running a Test Google Kubernetes Engine Cluster](#running-a-test-google-kubernetes-engine-cluster)
* [Running a Test Minikube cluster](#running-a-test-minikube-cluster)
Expand Down Expand Up @@ -64,6 +64,7 @@ Table of Contents
* [make gen-install](#make-gen-install)
* [make gen-embedded-openapi](#make-gen-embedded-openapi)
* [make gen-crd-client](#make-gen-crd-client)
* [make gen-all-sdk-grpc](#make-gen-all-sdk-grpc)
* [make gen-sdk-grpc](#make-gen-sdk-grpc)
* [Build Image Targets](#build-image-targets)
* [make clean-config](#make-clean-config)
Expand Down Expand Up @@ -654,8 +655,11 @@ This should be run against a clean or brand new cluster, as external CRD's or sc
#### `make gen-crd-client`
Generate the Custom Resource Definition client(s)

#### `make gen-all-sdk-grpc`
Generate the SDK gRPC server and client code for all SDKs.

#### `make gen-sdk-grpc`
Generate the SDK gRPC server and client code
Generate the SDK gRPC server and client code for a single SDK (specified in the `SDK_FOLDER` variable).

### Build Image Targets

Expand Down
4 changes: 2 additions & 2 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apt-get update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GOPATH /go
ENV GO111MODULE=on
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down Expand Up @@ -67,7 +67,7 @@ RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
RUN echo "source <(helm completion bash)" >> /root/.bashrc

# install golang-ci linter
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49.0

#
# \ \ / /__| |__ ___(_) |_ ___
Expand Down
6 changes: 3 additions & 3 deletions build/build-sdk-images/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get --allow-releaseinfo-change update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GO111MODULE=on
ENV GOPATH /go
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand All @@ -29,8 +29,8 @@ RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
ENV PATH /usr/local/go/bin:/go/bin:$PATH

# install go-proto-gen 1.1
RUN go get github.com/golang/protobuf/[email protected] && \
go get -u golang.org/x/tools/cmd/goimports
RUN go install github.com/golang/protobuf/[email protected] && \
go install golang.org/x/tools/cmd/goimports@latest


# code generation scripts
Expand Down
2 changes: 1 addition & 1 deletion build/build-sdk-images/restapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get --allow-releaseinfo-change update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GO111MODULE=on
ENV GOPATH /go
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down
2 changes: 1 addition & 1 deletion build/e2e-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GOPATH /go
ENV GO111MODULE=on
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down
13 changes: 6 additions & 7 deletions cmd/allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 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
// 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,
Expand All @@ -18,7 +18,6 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -574,17 +573,17 @@ func getCACertPool(path string) (*x509.CertPool, error) {
// Add all certificates under client-certs path because there could be multiple clusters
// and all client certs should be added.
caCertPool := x509.NewCertPool()
filesInfo, err := ioutil.ReadDir(path)
dirEntries, err := os.ReadDir(path)
if err != nil {
return nil, fmt.Errorf("error reading certs from dir %s: %s", path, err.Error())
}

for _, file := range filesInfo {
if !strings.HasSuffix(file.Name(), ".crt") && !strings.HasSuffix(file.Name(), ".pem") {
for _, dirEntry := range dirEntries {
if !strings.HasSuffix(dirEntry.Name(), ".crt") && !strings.HasSuffix(dirEntry.Name(), ".pem") {
continue
}
certFile := filepath.Join(path, file.Name())
caCert, err := ioutil.ReadFile(certFile)
certFile := filepath.Join(path, dirEntry.Name())
caCert, err := os.ReadFile(certFile)
if err != nil {
logger.Errorf("CA cert is not readable or missing: %s", err.Error())
continue
Expand Down
10 changes: 6 additions & 4 deletions cmd/allocator/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 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
// 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,
Expand All @@ -18,7 +18,6 @@ import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"net/http"
"os"
"testing"
Expand Down Expand Up @@ -197,14 +196,17 @@ func TestVerifyClientCertificateFails(t *testing.T) {
func TestGettingCaCert(t *testing.T) {
t.Parallel()

file, err := ioutil.TempFile(".", "*.crt")
file, err := os.CreateTemp(".", "*.crt")
if assert.Nil(t, err) {
defer os.Remove(file.Name()) // nolint: errcheck
_, err = file.WriteString(clientCert)
if assert.Nil(t, err) {
certPool, err := getCACertPool("./")
if assert.Nil(t, err) {
assert.Len(t, certPool.Subjects(), 1)
// linting complaints certPool.Subjects() has been deprecated since Go 1.18.
// But since this cert doesn't come from SystemCertPool, it doesn't seem behavior
// should be impacted. So marking the lint as ignored.
assert.Len(t, certPool.Subjects(), 1) // nolint
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/allocator/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 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
// 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,
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ REPOSITORY = gcr.io/agones-images
# Directory that this Makefile is in.
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/allocation-endpoint-proxy:0.1
server_tag = $(REPOSITORY)/allocation-endpoint-proxy:0.2
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module agones.dev/agones/examples/allocation-endpoint/client

go 1.18
go 1.19

require (
agones.dev/agones v1.21.0
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# syntax=docker/dockerfile:1

FROM golang:1.16-alpine
FROM golang:1.19-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/server/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module agones.dev/agones/examples/allocation-endpoint/server

go 1.18
go 1.19

require (
agones.dev/agones v1.21.0
Expand Down
8 changes: 4 additions & 4 deletions examples/allocator-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"os"

pb "agones.dev/agones/pkg/allocation/go"
"github.com/pkg/errors"
Expand All @@ -40,15 +40,15 @@ func main() {
flag.Parse()

endpoint := *externalIP + ":" + *port
cert, err := ioutil.ReadFile(*certFile)
cert, err := os.ReadFile(*certFile)
if err != nil {
panic(err)
}
key, err := ioutil.ReadFile(*keyFile)
key, err := os.ReadFile(*keyFile)
if err != nil {
panic(err)
}
cacert, err := ioutil.ReadFile(*cacertFile)
cacert, err := os.ReadFile(*cacertFile)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Gather dependencies and build the executable
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src/autoscaler-webhook

COPY examples/autoscaler-webhook/main.go .
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REPOSITORY = gcr.io/agones-images

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.4
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.5
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/autoscaler-service-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
secretName: autoscalersecret
containers:
- name: autoscaler-webhook
image: gcr.io/agones-images/autoscaler-webhook:0.4
image: gcr.io/agones-images/autoscaler-webhook:0.5
imagePullPolicy: Always
volumeMounts:
- mountPath: /home/service/certs
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/autoscaler-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
#serviceAccount: autoscaler-webhook
containers:
- name: autoscaler-webhook
image: gcr.io/agones-images/autoscaler-webhook:0.4
image: gcr.io/agones-images/autoscaler-webhook:0.5
imagePullPolicy: Always
ports:
- name: autoscaler
Expand Down
5 changes: 2 additions & 3 deletions examples/autoscaler-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//Autoscaler webhook server which handles FleetAutoscaleReview json payload
// Autoscaler webhook server which handles FleetAutoscaleReview json payload
package main

import (
"encoding/json"
"flag"
"io"
"io/ioutil"
"math"
"net/http"
"os"
Expand Down Expand Up @@ -137,7 +136,7 @@ func handleAutoscale(w http.ResponseWriter, r *http.Request) {
}

var faReq autoscalingv1.FleetAutoscaleReview
res, err := ioutil.ReadAll(r.Body)
res, err := io.ReadAll(r.Body)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Gather dependencies and build the executable
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src/crd-client

COPY ./main.go .
Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

REPOSITORY ?= gcr.io/agones-images

server_tag = $(REPOSITORY)/crd-client:0.6
server_tag = $(REPOSITORY)/crd-client:0.7

# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
Expand Down
4 changes: 2 additions & 2 deletions examples/crd-client/create-gs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ spec:
serviceAccountName: agones-controller
containers:
- name: create-gameserver
image: gcr.io/agones-images/crd-client:0.6
image: gcr.io/agones-images/crd-client:0.7
imagePullPolicy: Always
env:
- name: GAMESERVER_IMAGE
value: "gcr.io/agones-images/simple-game-server:0.13"
value: "gcr.io/agones-images/simple-game-server:0.14"
restartPolicy: Never
2 changes: 1 addition & 1 deletion examples/fleet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ spec:
spec:
containers:
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.13
image: gcr.io/agones-images/simple-game-server:0.14
2 changes: 1 addition & 1 deletion examples/gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spec:
spec:
containers:
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.13
image: gcr.io/agones-images/simple-game-server:0.14
imagePullPolicy: Always
# nodeSelector is a label that can be used to tell Kubernetes which host
# OS to use. For Windows game servers uncomment the nodeSelector
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-game-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# build
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src
COPY . agones.dev/agones

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-game-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ WITH_ARM64=1

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REGISTRY)/simple-game-server:0.13
server_tag = $(REGISTRY)/simple-game-server:0.14

ifeq ($(WITH_WINDOWS), 1)
server_tag_linux_amd64 = $(server_tag)-linux-amd64
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-game-server/dev-gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ spec:
spec:
containers:
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.13
image: gcr.io/agones-images/simple-game-server:0.14
2 changes: 1 addition & 1 deletion examples/simple-game-server/fleet-distributed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
spec:
containers:
- name: simple-game-server
image: gcr.io/agones-images/simple-game-server:0.13
image: gcr.io/agones-images/simple-game-server:0.14
resources:
requests:
memory: "64Mi"
Expand Down
Loading

0 comments on commit f1df1bd

Please sign in to comment.