Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update developer tooling to Helm 3 #1647

Merged
merged 3 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ site_path := $(agones_path)/site
kubeconfig_path := $(dir $(KUBECONFIG))
kubeconfig_file := $(notdir $(KUBECONFIG))

helm_path := ~/.helm
helm_config := ~/.config/helm
helm_cache := ~/.cache/helm

agones_package = agones.dev/agones
mount_path = /go/src/$(agones_package)
common_mounts = -v $(build_path)/.config/gcloud:/root/.config/gcloud \
-v $(kubeconfig_path):/root/.kube \
-v $(helm_path):/root/.helm \
-v $(helm_config):/root/.config/helm \
-v $(helm_cache):/root/.cache/helm \
-v $(agones_path):$(mount_path) \
-v $(build_path)/.gomod:/go/pkg/mod

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

# push the current chart to google cloud storage and update the index
push-chart: $(ensure-build-image) build-chart
Expand Down Expand Up @@ -299,7 +301,8 @@ install: LOG_LEVEL := "debug"
install: FEATURE_GATES ?= $(ALPHA_FEATURE_GATES)
install: $(ensure-build-image) install-custom-pull-secret
$(DOCKER_RUN) \
helm upgrade --install --wait --namespace=agones-system\
helm upgrade --install --wait --namespace=agones-system \
--create-namespace \
--set agones.image.tag=$(VERSION),agones.image.registry=$(REGISTRY) \
--set agones.image.controller.pullPolicy=$(IMAGE_PULL_POLICY),agones.image.sdk.alwaysPull=$(ALWAYS_PULL_SIDECAR) \
--set agones.image.controller.pullSecret=$(IMAGE_PULL_SECRET) \
Expand All @@ -312,7 +315,7 @@ install: $(ensure-build-image) install-custom-pull-secret

uninstall: $(ensure-build-image)
$(DOCKER_RUN) \
helm delete --purge agones
helm uninstall agones --namespace=agones-system


# Build a static binary for the gameserver controller
Expand Down Expand Up @@ -407,7 +410,7 @@ push-agones-sdk-image: $(ensure-build-image)
# Generate the static install script
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 \
'helm template 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 \
Expand Down Expand Up @@ -443,42 +446,40 @@ setup-prometheus: PVC ?= true
setup-prometheus: PV_SIZE ?= 64Gi
setup-prometheus: SCRAPE_INTERVAL=30s
setup-prometheus:
$(DOCKER_RUN) \
helm upgrade --install --wait prom stable/prometheus --namespace metrics \
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
$(DOCKER_RUN) helm repo update
$(DOCKER_RUN) helm upgrade prom stable/prometheus \
--install --wait --namespace metrics --create-namespace \
roberthbailey marked this conversation as resolved.
Show resolved Hide resolved
--set server.global.scrape_interval=$(SCRAPE_INTERVAL),server.persistentVolume.enabled=$(PVC),server.persistentVolume.size=$(PV_SIZE) \
$(HELM_ARGS) \
-f $(mount_path)/build/prometheus.yaml
$(HELM_ARGS) -f $(mount_path)/build/prometheus.yaml

uninstall-prometheus: $(ensure-build-image)
$(DOCKER_RUN) \
helm delete --purge prom
helm uninstall prom --namespace=metrics

# setup grafana in the current cluster with datasource and dashboards ready for use with agones
# by default Persistent Volume Claims are requested.
setup-grafana: PVC ?= true
setup-grafana: PV_SIZE ?= 64Gi
setup-grafana: PASSWORD ?= admin
setup-grafana:
-$(DOCKER_RUN) kubectl create namespace metrics
roberthbailey marked this conversation as resolved.
Show resolved Hide resolved
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
$(DOCKER_RUN) helm repo update
$(DOCKER_RUN) kubectl apply -f $(mount_path)/build/grafana/
$(DOCKER_RUN) \
helm upgrade --install --wait grafana stable/grafana --version=5.0.13 --namespace metrics \
$(DOCKER_RUN) helm upgrade grafana stable/grafana \
--install --wait --namespace metrics \
--set persistence.enabled=$(PVC),server.persistentVolume.size=$(PV_SIZE) \
--set adminPassword=$(PASSWORD) -f $(mount_path)/build/grafana.yaml

uninstall-grafana: $(ensure-build-image)
$(DOCKER_RUN) \
helm delete --purge grafana
$(DOCKER_RUN) helm uninstall grafana --namespace=metrics
$(DOCKER_RUN) kubectl delete -f $(mount_path)/build/grafana/

helm-repo-update:
$(DOCKER_RUN) helm repo update

setup-test-cluster: DOCKER_RUN_ARGS+=--network=host
setup-test-cluster: $(ensure-build-image)
$(DOCKER_RUN) kubectl apply -f $(mount_path)/build/helm.yaml
$(DOCKER_RUN) helm init --wait --service-account helm

clean-test-cluster: $(ensure-build-image) $(uninstall)
docker run --rm -it $(common_mounts) -e "KUBECONFIG=/root/.kube/$(kubeconfig_file)" $(DOCKER_RUN_ARGS) $(build_tag) helm reset

install-custom-pull-secret:
# if IMAGE_PULL_SECRET_FILE is specified, create the agones-system namespace and install the secret
Expand Down
13 changes: 0 additions & 13 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ Table of Contents
* [make kind-test-e2e](#make-kind-test-e2e)
* [make kind-shell](#make-kind-shell)
* [make kind-controller-portforward](#make-kind-controller-portforward)
* [Custom Environment](#custom-environment)
* [make setup-test-cluster](#make-setup-test-cluster)
* [make clean-test-cluster](#make-clean-test-cluster)
* [Dependencies](#dependencies)
* [Troubleshooting](#troubleshooting)
* [$GOPATH/$GOROOT error when building in WSL](#gopathgoroot-error-when-building-in-wsl)
Expand Down Expand Up @@ -352,8 +349,6 @@ To begin, you need to set up the following environment variables:
if set, `make install` will install this secret in both the `agones-system` (for pulling the controller image)
and `default` (for pulling the sdk image) repositories

The second step is to prepare your cluster for the Agones deployments. Run `make setup-test-cluster` to install helm in it.

Now you're ready to begin the development/test cycle:
- `make build` will build Agones
- `make test` will run local tests, which includes `site-test` target
Expand Down Expand Up @@ -743,14 +738,6 @@ instead of `make shell` to start an interactive shell for development on Kind.
The Kind version of [`make controller-portforward`](#make-controller-portforward) to setup
port forwarding to the controller deployment.

### Custom Environment

#### `make setup-test-cluster`
Initializes your custom cluster for working with Agones, by installing Helm/Tiller.

#### `make clean-test-cluster`
Cleans up your custom cluster by resetting Helm.

## Dependencies

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).
Expand Down
4 changes: 2 additions & 2 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ RUN mkdir -p /go/src/k8s.io && cd /go/src/k8s.io && \
git clone -b kubernetes-${KUBERNETES_VER} --depth=3 https://github.com/kubernetes/code-generator.git

# install Helm package manager
ENV HELM_VER 2.12.0
ENV HELM_URL https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VER}-linux-amd64.tar.gz
ENV HELM_VER 3.2.3
ENV HELM_URL https://get.helm.sh/helm-v${HELM_VER}-linux-amd64.tar.gz
RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
&& tar -zxvf /tmp/helm.tar.gz -C /tmp \
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm \
Expand Down
4 changes: 2 additions & 2 deletions build/e2e-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECT
mv ./kubectl /usr/local/bin/kubectl

# install Helm package manager
ENV HELM_VER 2.11.0
ENV HELM_URL https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VER}-linux-amd64.tar.gz
ENV HELM_VER 3.2.3
ENV HELM_URL https://get.helm.sh/helm-v${HELM_VER}-linux-amd64.tar.gz
RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
&& tar -zxvf /tmp/helm.tar.gz -C /tmp \
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm \
Expand Down
53 changes: 0 additions & 53 deletions build/helm.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion build/includes/build-image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ ensure-build-config:
-mkdir -p $(kubeconfig_path)
-mkdir -p $(build_path)/.gocache
-mkdir -p $(build_path)/.config/gcloud
-mkdir -p $(helm_path)
-mkdir -p $(helm_config)
-mkdir -p $(helm_cache)

# create the build image if it doesn't exist
ensure-build-image: ensure-build-config
Expand Down
11 changes: 4 additions & 7 deletions build/includes/google-cloud.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ gcloud-test-cluster: $(ensure-build-image)
--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)\
--template=$(mount_path)/build/gke-test-cluster/cluster.yml.jinja
$(MAKE) gcloud-auth-cluster
$(MAKE) setup-test-cluster

clean-gcloud-test-cluster: $(ensure-build-image)
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
Expand All @@ -46,18 +45,16 @@ gcloud-e2e-test-cluster: $(ensure-build-image)
deployment-manager deployments create $(TEST_CLUSTER_NAME) \
--config=$(mount_path)/build/gke-test-cluster/cluster-e2e.yml
$(MAKE) gcloud-auth-cluster GCP_CLUSTER_NAME=$(TEST_CLUSTER_NAME) GCP_CLUSTER_ZONE=us-west1-c
$(DOCKER_RUN) helm repo add stable https://kubernetes-charts.storage.googleapis.com/
$(DOCKER_RUN) helm repo update
docker run --rm $(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 --wait
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
helm install --wait --set Replicas=1,uiService.type=ClusterIP --name consul stable/consul
helm install consul stable/consul --wait --set Replicas=1,uiService.type=ClusterIP

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

# Creates a gcloud cluster for prow
Expand Down
1 change: 0 additions & 1 deletion build/includes/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ kind-test-cluster: $(ensure-build-image)
echo "Could not find $(KIND_PROFILE) cluster. Creating...";\
kind create cluster --name $(KIND_PROFILE) --image kindest/node:v1.15.7 --wait 5m;\
fi
$(MAKE) setup-test-cluster DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS)"

# deletes the kind agones cluster
# useful if you're want to start from scratch
Expand Down
1 change: 0 additions & 1 deletion build/includes/minikube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ minikube-test-cluster: $(ensure-build-image) minikube-agones-profile
echo "Waiting for cluster to start..."; \
sleep 1; \
done
$(MAKE) setup-test-cluster DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS)"
$(MAKE) minikube-post-start

# switch to the agones cluster
Expand Down
Loading