Skip to content

Commit

Permalink
Merge branch 'master' into prep/0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
markmandel authored May 21, 2019
2 parents 7c3f82f + 6683b41 commit 64a06e3
Show file tree
Hide file tree
Showing 57 changed files with 2,104 additions and 163 deletions.
24 changes: 21 additions & 3 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ KIND_PROFILE ?= agones
KIND_CONTAINER_NAME=kind-$(KIND_PROFILE)-control-plane

# Game Server image to use while doing end-to-end tests
GS_TEST_IMAGE ?= gcr.io/agones-images/udp-server:0.8
GS_TEST_IMAGE ?= gcr.io/agones-images/udp-server:0.9

# Directory that this Makefile is in.
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
Expand Down Expand Up @@ -86,6 +86,7 @@ build_tag = agones-build:$(build_version)
controller_tag = $(REGISTRY)/agones-controller:$(VERSION)
sidecar_tag = $(REGISTRY)/agones-sdk:$(VERSION)
ping_tag = $(REGISTRY)/agones-ping:$(VERSION)
allocator_tag = $(REGISTRY)/agones-allocator:$(VERSION)

gomod_on = GO111MODULE=on

Expand Down Expand Up @@ -197,7 +198,7 @@ include ./includes/sdk.mk
build: build-images build-sdks

# build the docker images
build-images: build-controller-image build-agones-sdk-image build-ping-image
build-images: build-controller-image build-agones-sdk-image build-ping-image build-allocator-image

# package the current agones helm chart
build-chart: RELEASE_VERSION ?= $(base_version)
Expand Down Expand Up @@ -262,12 +263,13 @@ test-install-yaml:
diff /tmp/agones-install/install.yaml.sorted /tmp/agones-install/install.current.yaml.sorted

# Push all the images up to $(REGISTRY)
push: push-controller-image push-agones-sdk-image push-ping-image
push: push-controller-image push-agones-sdk-image push-ping-image push-allocator-image

# Installs the current development version of Agones into the Kubernetes cluster
install: ALWAYS_PULL_SIDECAR := true
install: IMAGE_PULL_POLICY := "Always"
install: PING_SERVICE_TYPE := "LoadBalancer"
install: ALLOCATOR_SERVICE_TYPE := "LoadBalancer"
install: CRD_CLEANUP := true
install: $(ensure-build-image) install-custom-pull-secret
$(DOCKER_RUN) \
Expand All @@ -276,6 +278,7 @@ install: $(ensure-build-image) install-custom-pull-secret
--set agones.image.controller.pullPolicy=$(IMAGE_PULL_POLICY),agones.image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \
--set agones.image.controller.pullSecret=$(IMAGE_PULL_SECRET) \
--set agones.ping.http.serviceType=$(PING_SERVICE_TYPE),agones.ping.udp.serviceType=$(PING_SERVICE_TYPE) \
--set agones.allocator.http.serviceType=$(ALLOCATOR_SERVICE_TYPE) \
--set agones.crds.cleanupOnDelete=$(CRD_CLEANUP) \
agones $(mount_path)/install/helm/agones/

Expand Down Expand Up @@ -351,6 +354,20 @@ push-ping-image: $(ensure-build-image)
build-ping-image: $(ensure-build-image) build-ping-binary build-licenses build-required-src-dist
docker build $(agones_path)/cmd/ping/ --tag=$(ping_tag) $(DOCKER_BUILD_ARGS)

# Build a static binary for the allocator service
build-allocator-binary: $(ensure-build-image)
$(GO_BUILD_LINUX_AMD64) \
-tags $(GO_BUILD_TAGS) -o $(go_build_base_path)/cmd/allocator/bin/allocator \
$(go_rebuild_flags) $(go_version_flags) -installsuffix cgo $(agones_package)/cmd/allocator

# Pushes up the allocator image
push-allocator-image: $(ensure-build-image)
docker push $(allocator_tag)

# Build the image for the allocator service
build-allocator-image: $(ensure-build-image) build-allocator-binary build-licenses build-required-src-dist
docker build $(agones_path)/cmd/allocator/ --tag=$(allocator_tag) $(DOCKER_BUILD_ARGS)

# push the gameservers sidecar image
push-agones-sdk-image: $(ensure-build-image)
docker push $(sidecar_tag)
Expand All @@ -360,6 +377,7 @@ gen-install: $(ensure-build-image)
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \
'helm template --name=agones-manual --namespace agones-system $(mount_path)/install/helm/agones \
--set agones.controller.generateTLS=false \
--set agones.allocator.generateTLS=false \
--set agones.crds.cleanupOnDelete=false \
> $(mount_path)/install/yaml/install.yaml'

Expand Down
2 changes: 1 addition & 1 deletion build/build-required-src-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tar -zcf ${TMP_DEPS_SRC} -C ${SRC_ROOT}/vendor/ \
github.com/hashicorp/golang-lru \
github.com/hashicorp/hcl

for ddir in ${SRC_ROOT}/cmd/controller/bin/ ${SRC_ROOT}/cmd/ping/bin/ ${SRC_ROOT}/cmd/sdk-server/bin/ ; do
for ddir in ${SRC_ROOT}/cmd/controller/bin/ ${SRC_ROOT}/cmd/ping/bin/ ${SRC_ROOT}/cmd/sdk-server/bin/ ${SRC_ROOT}/cmd/allocator/bin/ ; do
mkdir -p ${ddir}
cp ${TMP_DEPS_SRC} ${ddir}
done
Expand Down
2 changes: 1 addition & 1 deletion build/extract-licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ while read -r entry; do
append_license ${LIBRARY} ${entry}
done <<< "$(find vendor/ -regextype posix-extended -iregex '.*LICENSE(\.txt)?')"

for ddir in ${SRC_ROOT}/cmd/controller/bin/ ${SRC_ROOT}/cmd/ping/bin/ ${SRC_ROOT}/cmd/sdk-server/bin/ ; do
for ddir in ${SRC_ROOT}/cmd/controller/bin/ ${SRC_ROOT}/cmd/ping/bin/ ${SRC_ROOT}/cmd/sdk-server/bin/ ${SRC_ROOT}/cmd/allocator/bin/ ; do
mkdir -p ${ddir}
cp ${TMP_LICENSES} ${ddir}
done
Expand Down
7 changes: 7 additions & 0 deletions build/helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ variable "image_pull_secret" {
variable "ping_service_type" {
default = "LoadBalancer"
}
variable "allocator_service_type" {
default = "LoadBalancer"
}

variable "values_file" {
default = "../install/helm/agones/values.yaml"
Expand Down Expand Up @@ -177,6 +180,10 @@ resource "helm_release" "agones" {
name = "agones.ping.udp.serviceType"
value = "${var.ping_service_type}"
}
set {
name = " agones.allocator.http.serviceType"
value = "${var.allocator_service_type}"
}
version = "${var.agones_version}"
namespace = "agones-system"
}
Expand Down
106 changes: 106 additions & 0 deletions build/modules/aks/aks.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copyright 2019 Google LLC 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.

provider "azuread" {
version = "=0.1.0"
}

# Create Service Principal password
resource "azuread_service_principal_password" "aks" {
end_date = "2299-12-30T23:00:00Z" # Forever
service_principal_id = "${azuread_service_principal.aks.id}"
value = "${random_string.password.result}"
}

# Create Azure AD Application for Service Principal
resource "azuread_application" "aks" {
name = "agones-sp"
}

# Create Service Principal
resource "azuread_service_principal" "aks" {
application_id = "${azuread_application.aks.application_id}"
}

# Generate random string to be used for Service Principal Password
resource "random_string" "password" {
length = 32
special = true
}

resource "azurerm_resource_group" "test" {
name = "agonesRG"
location = "East US"
}

resource "azurerm_kubernetes_cluster" "test" {
name = "${var.cluster_name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
dns_prefix = "agones"
// Version 1.11.8 has issues with RBAC on AKS
// So this parameter is commented out
//kubernetes_version = "1.11.8"


agent_pool_profile {
name = "default"
count = 2
vm_size = "${var.machine_type}"
os_type = "Linux"
os_disk_size_gb = 30
}

service_principal {
client_id = "${azuread_application.aks.application_id}"
client_secret = "${azuread_service_principal_password.aks.value}"
}
tags = {
Environment = "Production"
}
}
resource "azurerm_network_security_group" "test" {
name = "agonesSecurityGroup"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
}

resource "azurerm_network_security_rule" "gameserver" {
name = "gameserver"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "UDP"
source_port_range = "*"
destination_port_range = "7000-8000"
source_address_prefix = "*"
destination_address_prefix = "*"
resource_group_name = "${azurerm_resource_group.test.name}"
network_security_group_name = "${azurerm_network_security_group.test.name}"
}


resource "azurerm_network_security_rule" "outbound" {
name = "outbound"
priority = 100
direction = "Outbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
resource_group_name = "${azurerm_resource_group.test.name}"
network_security_group_name = "${azurerm_network_security_group.test.name}"
}
34 changes: 34 additions & 0 deletions build/modules/aks/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2019 Google LLC 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.

output "cluster_ca_certificate" {
value = "${base64decode(azurerm_kubernetes_cluster.test.kube_config.0.cluster_ca_certificate)}"
}

output "client_certificate" {
value = "${azurerm_kubernetes_cluster.test.kube_config.0.client_certificate}"
}

output "kube_config" {
value = "${azurerm_kubernetes_cluster.test.kube_config_raw}"
}

output "host" {
value = "${azurerm_kubernetes_cluster.test.kube_config.0.host}"
}

output "token" {
value = "${azurerm_kubernetes_cluster.test.kube_config.0.password}"
}

21 changes: 21 additions & 0 deletions build/modules/aks/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2019 Google LLC 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.

variable "machine_type" {
default = "Standard_D2_v2"
}

variable "cluster_name" {
default="test-cluster"
}
Loading

0 comments on commit 64a06e3

Please sign in to comment.