Skip to content

Commit

Permalink
Merge pull request #170 from markmandel/feature/helm-0.2
Browse files Browse the repository at this point in the history
Integrated Helm into the `build` and development system
  • Loading branch information
cyriltovena authored Apr 10, 2018
2 parents a1477e9 + 220bbea commit 794dcdb
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 350 deletions.
17 changes: 9 additions & 8 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ push: push-controller-image push-agones-sdk-image
install: ALWAYS_PULL_SIDECAR := true
install: IMAGE_PULL_POLICY := "Always"
install: ensure-build-image
cp $(build_path)/install.yaml $(build_path)/.install.yaml
sed -i -e 's!$${REGISTRY}!$(REGISTRY)!g' $(build_path)/.install.yaml
sed -i -e 's!$${VERSION}!$(VERSION)!g' $(build_path)/.install.yaml
sed -i -e 's!$${IMAGE_PULL_POLICY}!$(IMAGE_PULL_POLICY)!g' $(build_path)/.install.yaml
sed -i -e 's!$${ALWAYS_PULL_SIDECAR}!$(ALWAYS_PULL_SIDECAR)!g' $(build_path)/.install.yaml
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl apply -f $(mount_path)/build/.install.yaml
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
helm upgrade --install --namespace=default \
--set image.tag=$(VERSION),image.registry=$(REGISTRY),image.controller.pullPolicy=$(IMAGE_PULL_POLICY),image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \
agones $(mount_path)/install/helm/agones/

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

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

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

# switch to the agones cluster
Expand Down
2 changes: 1 addition & 1 deletion build/gke-test-cluster/cluster.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resources:
cluster:
name: test-cluster
description: Test cluster for Agones
initialClusterVersion: 1.9.2-gke.1 # be specific until 1.9.x becomes default
initialClusterVersion: 1.9.6-gke.0 # be specific until 1.9.x becomes default
nodePools:
- name: "default"
initialNodeCount: 3
Expand Down
34 changes: 34 additions & 0 deletions build/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2018 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.

# Service account for helm

apiVersion: v1
kind: ServiceAccount
metadata:
name: helm
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: helm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: helm
namespace: kube-system
Loading

0 comments on commit 794dcdb

Please sign in to comment.