Skip to content

Commit 9a1d132

Browse files
markmandelRobert Bailey
andauthored
Update developer tooling to Helm 3 (agones-dev#1647)
* Update developer tooling to Helm 3 This updates the developer tooling to Helm 3. Tiller can happily live alongside Helm 2, but you will want to remove the Agones helm 2 install, as it will overlap with the Helm 3 installation. If you want to hand remove Agones - delete the agones-system namespace, and remove all agones CRDs. (`kubectl get crds | grep agones`) The `tiller-deploy` deployment can also be deleted from the Kubernetes namespace if you need to hand remove Helm 2 as well. Work on agones-dev#1436 Co-authored-by: Robert Bailey <robertbailey@google.com>
1 parent 4c857b1 commit 9a1d132

10 files changed

Lines changed: 499 additions & 591 deletions

File tree

‎build/Makefile‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ site_path := $(agones_path)/site
7070
kubeconfig_path := $(dir $(KUBECONFIG))
7171
kubeconfig_file := $(notdir $(KUBECONFIG))
7272

73-
helm_path := ~/.helm
73+
helm_config := ~/.config/helm
74+
helm_cache := ~/.cache/helm
7475

7576
agones_package = agones.dev/agones
7677
mount_path = /go/src/$(agones_package)
7778
common_mounts = -v $(build_path)/.config/gcloud:/root/.config/gcloud \
7879
-v $(kubeconfig_path):/root/.kube \
79-
-v $(helm_path):/root/.helm \
80+
-v $(helm_config):/root/.config/helm \
81+
-v $(helm_cache):/root/.cache/helm \
8082
-v $(agones_path):$(mount_path) \
8183
-v $(build_path)/.gomod:/go/pkg/mod
8284

@@ -210,7 +212,7 @@ build-chart: CHART_DIR ?= install/helm/agones/
210212
build-chart: $(ensure-build-image)
211213
docker run --rm $(common_mounts) -w $(workdir_path) $(build_tag) bash -c \
212214
"mkdir -p install/helm/bin/ && rm -rf install/helm/bin/* && \
213-
helm init --client-only && helm package -d install/helm/bin/ --version $(RELEASE_VERSION) $(CHART_DIR)"
215+
helm package -d install/helm/bin/ --version $(RELEASE_VERSION) $(CHART_DIR)"
214216

215217
# push the current chart to google cloud storage and update the index
216218
push-chart: $(ensure-build-image) build-chart
@@ -299,7 +301,8 @@ install: LOG_LEVEL := "debug"
299301
install: FEATURE_GATES ?= $(ALPHA_FEATURE_GATES)
300302
install: $(ensure-build-image) install-custom-pull-secret
301303
$(DOCKER_RUN) \
302-
helm upgrade --install --wait --namespace=agones-system\
304+
helm upgrade --install --wait --namespace=agones-system \
305+
--create-namespace \
303306
--set agones.image.tag=$(VERSION),agones.image.registry=$(REGISTRY) \
304307
--set agones.image.controller.pullPolicy=$(IMAGE_PULL_POLICY),agones.image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \
305308
--set agones.image.controller.pullSecret=$(IMAGE_PULL_SECRET) \
@@ -312,7 +315,7 @@ install: $(ensure-build-image) install-custom-pull-secret
312315

313316
uninstall: $(ensure-build-image)
314317
$(DOCKER_RUN) \
315-
helm delete --purge agones
318+
helm uninstall agones --namespace=agones-system
316319

317320

318321
# Build a static binary for the gameserver controller
@@ -407,7 +410,7 @@ push-agones-sdk-image: $(ensure-build-image)
407410
# Generate the static install script
408411
gen-install: $(ensure-build-image)
409412
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \
410-
'helm template --name=agones-manual --namespace agones-system $(mount_path)/install/helm/agones \
413+
'helm template agones-manual --namespace agones-system $(mount_path)/install/helm/agones \
411414
--set agones.controller.generateTLS=false \
412415
--set agones.allocator.generateTLS=false \
413416
--set agones.crds.cleanupOnDelete=false \
@@ -443,42 +446,40 @@ setup-prometheus: PVC ?= true
443446
setup-prometheus: PV_SIZE ?= 64Gi
444447
setup-prometheus: SCRAPE_INTERVAL=30s
445448
setup-prometheus:
446-
$(DOCKER_RUN) \
447-
helm upgrade --install --wait prom stable/prometheus --namespace metrics \
449+
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
450+
$(DOCKER_RUN) helm repo update
451+
$(DOCKER_RUN) helm upgrade prom stable/prometheus \
452+
--install --wait --namespace metrics --create-namespace \
448453
--set server.global.scrape_interval=$(SCRAPE_INTERVAL),server.persistentVolume.enabled=$(PVC),server.persistentVolume.size=$(PV_SIZE) \
449-
$(HELM_ARGS) \
450-
-f $(mount_path)/build/prometheus.yaml
454+
$(HELM_ARGS) -f $(mount_path)/build/prometheus.yaml
451455

452456
uninstall-prometheus: $(ensure-build-image)
453457
$(DOCKER_RUN) \
454-
helm delete --purge prom
458+
helm uninstall prom --namespace=metrics
455459

456460
# setup grafana in the current cluster with datasource and dashboards ready for use with agones
457461
# by default Persistent Volume Claims are requested.
458462
setup-grafana: PVC ?= true
459463
setup-grafana: PV_SIZE ?= 64Gi
460464
setup-grafana: PASSWORD ?= admin
461465
setup-grafana:
466+
-$(DOCKER_RUN) kubectl create namespace metrics
467+
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
468+
$(DOCKER_RUN) helm repo update
462469
$(DOCKER_RUN) kubectl apply -f $(mount_path)/build/grafana/
463-
$(DOCKER_RUN) \
464-
helm upgrade --install --wait grafana stable/grafana --version=5.0.13 --namespace metrics \
470+
$(DOCKER_RUN) helm upgrade grafana stable/grafana \
471+
--install --wait --namespace metrics \
465472
--set persistence.enabled=$(PVC),server.persistentVolume.size=$(PV_SIZE) \
466473
--set adminPassword=$(PASSWORD) -f $(mount_path)/build/grafana.yaml
467474

468475
uninstall-grafana: $(ensure-build-image)
469-
$(DOCKER_RUN) \
470-
helm delete --purge grafana
476+
$(DOCKER_RUN) helm uninstall grafana --namespace=metrics
477+
$(DOCKER_RUN) kubectl delete -f $(mount_path)/build/grafana/
471478

472479
helm-repo-update:
473480
$(DOCKER_RUN) helm repo update
474481

475-
setup-test-cluster: DOCKER_RUN_ARGS+=--network=host
476-
setup-test-cluster: $(ensure-build-image)
477-
$(DOCKER_RUN) kubectl apply -f $(mount_path)/build/helm.yaml
478-
$(DOCKER_RUN) helm init --wait --service-account helm
479-
480482
clean-test-cluster: $(ensure-build-image) $(uninstall)
481-
docker run --rm -it $(common_mounts) -e "KUBECONFIG=/root/.kube/$(kubeconfig_file)" $(DOCKER_RUN_ARGS) $(build_tag) helm reset
482483

483484
install-custom-pull-secret:
484485
# if IMAGE_PULL_SECRET_FILE is specified, create the agones-system namespace and install the secret

‎build/README.md‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ Table of Contents
8989
* [make kind-test-e2e](#make-kind-test-e2e)
9090
* [make kind-shell](#make-kind-shell)
9191
* [make kind-controller-portforward](#make-kind-controller-portforward)
92-
* [Custom Environment](#custom-environment)
93-
* [make setup-test-cluster](#make-setup-test-cluster)
94-
* [make clean-test-cluster](#make-clean-test-cluster)
9592
* [Dependencies](#dependencies)
9693
* [Troubleshooting](#troubleshooting)
9794
* [$GOPATH/$GOROOT error when building in WSL](#gopathgoroot-error-when-building-in-wsl)
@@ -352,8 +349,6 @@ To begin, you need to set up the following environment variables:
352349
if set, `make install` will install this secret in both the `agones-system` (for pulling the controller image)
353350
and `default` (for pulling the sdk image) repositories
354351

355-
The second step is to prepare your cluster for the Agones deployments. Run `make setup-test-cluster` to install helm in it.
356-
357352
Now you're ready to begin the development/test cycle:
358353
- `make build` will build Agones
359354
- `make test` will run local tests, which includes `site-test` target
@@ -743,14 +738,6 @@ instead of `make shell` to start an interactive shell for development on Kind.
743738
The Kind version of [`make controller-portforward`](#make-controller-portforward) to setup
744739
port forwarding to the controller deployment.
745740

746-
### Custom Environment
747-
748-
#### `make setup-test-cluster`
749-
Initializes your custom cluster for working with Agones, by installing Helm/Tiller.
750-
751-
#### `make clean-test-cluster`
752-
Cleans up your custom cluster by resetting Helm.
753-
754741
## Dependencies
755742

756743
This project uses the [go modules](https://github.com/golang/go/wiki/Modules) as its manager. You can see the list of dependencies [here](https://github.com/googleforgames/agones/blob/master/go.mod).

‎build/build-image/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ RUN mkdir -p /go/src/k8s.io && cd /go/src/k8s.io && \
5858
git clone -b kubernetes-${KUBERNETES_VER} --depth=3 https://github.com/kubernetes/code-generator.git
5959

6060
# install Helm package manager
61-
ENV HELM_VER 2.12.0
62-
ENV HELM_URL https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VER}-linux-amd64.tar.gz
61+
ENV HELM_VER 3.2.3
62+
ENV HELM_URL https://get.helm.sh/helm-v${HELM_VER}-linux-amd64.tar.gz
6363
RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
6464
&& tar -zxvf /tmp/helm.tar.gz -C /tmp \
6565
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm \

‎build/e2e-image/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECT
2121
mv ./kubectl /usr/local/bin/kubectl
2222

2323
# install Helm package manager
24-
ENV HELM_VER 2.11.0
25-
ENV HELM_URL https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VER}-linux-amd64.tar.gz
24+
ENV HELM_VER 3.2.3
25+
ENV HELM_URL https://get.helm.sh/helm-v${HELM_VER}-linux-amd64.tar.gz
2626
RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
2727
&& tar -zxvf /tmp/helm.tar.gz -C /tmp \
2828
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm \

‎build/helm.yaml‎

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎build/includes/build-image.mk‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ ensure-build-config:
3333
-mkdir -p $(kubeconfig_path)
3434
-mkdir -p $(build_path)/.gocache
3535
-mkdir -p $(build_path)/.config/gcloud
36-
-mkdir -p $(helm_path)
36+
-mkdir -p $(helm_config)
37+
-mkdir -p $(helm_cache)
3738

3839
# create the build image if it doesn't exist
3940
ensure-build-image: ensure-build-config

‎build/includes/google-cloud.mk‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ gcloud-test-cluster: $(ensure-build-image)
3232
--properties cluster.zone:$(GCP_CLUSTER_ZONE),cluster.name:$(GCP_CLUSTER_NAME),cluster.nodePool.initialNodeCount:$(GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT),cluster.nodePool.machineType:$(GCP_CLUSTER_NODEPOOL_MACHINETYPE)\
3333
--template=$(mount_path)/build/gke-test-cluster/cluster.yml.jinja
3434
$(MAKE) gcloud-auth-cluster
35-
$(MAKE) setup-test-cluster
3635

3736
clean-gcloud-test-cluster: $(ensure-build-image)
3837
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
@@ -46,18 +45,16 @@ gcloud-e2e-test-cluster: $(ensure-build-image)
4645
deployment-manager deployments create $(TEST_CLUSTER_NAME) \
4746
--config=$(mount_path)/build/gke-test-cluster/cluster-e2e.yml
4847
$(MAKE) gcloud-auth-cluster GCP_CLUSTER_NAME=$(TEST_CLUSTER_NAME) GCP_CLUSTER_ZONE=us-west1-c
48+
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
49+
$(DOCKER_RUN) helm repo update
4950
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
50-
kubectl apply -f $(mount_path)/build/helm.yaml
51-
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
52-
helm init --service-account helm --wait
53-
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
54-
helm install --wait --set Replicas=1,uiService.type=ClusterIP --name consul stable/consul
51+
helm install consul stable/consul --wait --set Replicas=1,uiService.type=ClusterIP
5552

5653
# Deletes the gcloud e2e cluster and cleanup any left pvc volumes
5754
clean-gcloud-e2e-test-cluster: TEST_CLUSTER_NAME ?= e2e-test-cluster
5855
clean-gcloud-e2e-test-cluster: $(ensure-build-image)
5956
-docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
60-
helm delete --purge consul && kubectl delete pvc -l component=consul-consul
57+
helm uninstall consul && kubectl delete pvc -l component=consul-consul
6158
$(MAKE) clean-gcloud-test-cluster GCP_CLUSTER_NAME=$(TEST_CLUSTER_NAME)
6259

6360
# Creates a gcloud cluster for prow

‎build/includes/kind.mk‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ kind-test-cluster: $(ensure-build-image)
2828
echo "Could not find $(KIND_PROFILE) cluster. Creating...";\
2929
kind create cluster --name $(KIND_PROFILE) --image kindest/node:v1.15.7 --wait 5m;\
3030
fi
31-
$(MAKE) setup-test-cluster DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS)"
3231

3332
# deletes the kind agones cluster
3433
# useful if you're want to start from scratch

‎build/includes/minikube.mk‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ minikube-test-cluster: $(ensure-build-image) minikube-agones-profile
3434
echo "Waiting for cluster to start..."; \
3535
sleep 1; \
3636
done
37-
$(MAKE) setup-test-cluster DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS)"
3837
$(MAKE) minikube-post-start
3938

4039
# switch to the agones cluster

0 commit comments

Comments
 (0)