Skip to content

Commit 220bbea

Browse files
committed
Integrated Helm into the build and development system
This removes the `sed` based templating and replaces it with a helm based workflow. All the `make` commands have stayed exactly the same. This also moves the existing 0.1 release helm chat to the 0.2 development chart, and includes the features that were otherwise missing for 0.2 If you have an existing development cluster, it may be easiest to delete them and recreate them, as the tooling will install helm automatically now on cluster creation. I also snuck in some small Kubernetes 1.9.x upgrades as well. Parent ticket: agones-dev#101
1 parent a1477e9 commit 220bbea

9 files changed

Lines changed: 108 additions & 350 deletions

File tree

build/Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ push: push-controller-image push-agones-sdk-image
108108
install: ALWAYS_PULL_SIDECAR := true
109109
install: IMAGE_PULL_POLICY := "Always"
110110
install: ensure-build-image
111-
cp $(build_path)/install.yaml $(build_path)/.install.yaml
112-
sed -i -e 's!$${REGISTRY}!$(REGISTRY)!g' $(build_path)/.install.yaml
113-
sed -i -e 's!$${VERSION}!$(VERSION)!g' $(build_path)/.install.yaml
114-
sed -i -e 's!$${IMAGE_PULL_POLICY}!$(IMAGE_PULL_POLICY)!g' $(build_path)/.install.yaml
115-
sed -i -e 's!$${ALWAYS_PULL_SIDECAR}!$(ALWAYS_PULL_SIDECAR)!g' $(build_path)/.install.yaml
116-
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl apply -f $(mount_path)/build/.install.yaml
111+
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
112+
helm upgrade --install --namespace=default \
113+
--set image.tag=$(VERSION),image.registry=$(REGISTRY),image.controller.pullPolicy=$(IMAGE_PULL_POLICY),image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \
114+
agones $(mount_path)/install/helm/agones/
117115

118116
# Build a static binary for the gameserver controller
119117
build-controller-binary: ensure-build-image
@@ -244,9 +242,11 @@ gcloud-init: ensure-build-config
244242

245243
# Creates and authenticates a small, 3 node GKE cluster to work against
246244
gcloud-test-cluster: ensure-build-image
247-
docker run --rm -it $(common_mounts) $(build_tag) gcloud \
245+
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
248246
deployment-manager deployments create test-cluster --config=$(mount_path)/build/gke-test-cluster/deployment.yml
249247
$(MAKE) gcloud-auth-cluster
248+
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl apply -f $(mount_path)/build/helm.yaml
249+
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) helm init --service-account helm
250250

251251
# Pulls down authentication information for kubectl against a cluster, name can be specified through CLUSTER_NAME
252252
# (defaults to 'test-cluster')
@@ -284,7 +284,7 @@ clean-gcloud-config:
284284
# Use MINIKUBE_DRIVER variable to change the VM driver
285285
# (defaults virtualbox for Linux and macOS, hyperv for windows) if you so desire.
286286
minikube-test-cluster: minikube-agones-profile
287-
$(MINIKUBE) start --kubernetes-version v1.9.0 --vm-driver $(MINIKUBE_DRIVER) \
287+
$(MINIKUBE) start --kubernetes-version v1.9.4 --vm-driver $(MINIKUBE_DRIVER) \
288288
--extra-config=apiserver.Admission.PluginNames=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota \
289289
--extra-config=apiserver.Authorization.Mode=RBAC
290290
# wait until the master is up
@@ -296,6 +296,7 @@ minikube-test-cluster: minikube-agones-profile
296296
# this is needed for kubernetes component to work correctly while RBAC is enabled
297297
-docker run --rm $(common_mounts) --network=host -v $(minikube_cert_mount) $(DOCKER_RUN_ARGS) $(build_tag) \
298298
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
299+
docker run --rm $(common_mounts) --network=host -v $(minikube_cert_mount) $(DOCKER_RUN_ARGS) $(build_tag) helm init
299300
$(MAKE) minikube-post-start
300301

301302
# switch to the agones cluster

build/gke-test-cluster/cluster.yml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resources:
2121
cluster:
2222
name: test-cluster
2323
description: Test cluster for Agones
24-
initialClusterVersion: 1.9.2-gke.1 # be specific until 1.9.x becomes default
24+
initialClusterVersion: 1.9.6-gke.0 # be specific until 1.9.x becomes default
2525
nodePools:
2626
- name: "default"
2727
initialNodeCount: 3

build/helm.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2018 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Service account for helm
16+
17+
apiVersion: v1
18+
kind: ServiceAccount
19+
metadata:
20+
name: helm
21+
namespace: kube-system
22+
---
23+
apiVersion: rbac.authorization.k8s.io/v1beta1
24+
kind: ClusterRoleBinding
25+
metadata:
26+
name: helm
27+
roleRef:
28+
apiGroup: rbac.authorization.k8s.io
29+
kind: ClusterRole
30+
name: cluster-admin
31+
subjects:
32+
- kind: ServiceAccount
33+
name: helm
34+
namespace: kube-system

0 commit comments

Comments
 (0)