Skip to content

Commit

Permalink
Generate the install.yaml from helm template
Browse files Browse the repository at this point in the history
This implements a `make gen-install` target that will generate the
install.yaml via `helm template`. This also extends `make test`
to have a test to ensure that the `install.yaml` is always kept
up to sync with the Helm chart, otehrwise the build will fail.

This does remove the explicit permissions for RBAC, but we don't
have a specific need for them right now, so I feel it's worth the
sacrifice to ensure these two configuration options stay in sync.

Blocks on googleforgames#170, Parent ticket: googleforgames#101
  • Loading branch information
markmandel committed Apr 10, 2018
1 parent 794dcdb commit 81a4c2b
Show file tree
Hide file tree
Showing 3 changed files with 287 additions and 112 deletions.
20 changes: 19 additions & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,22 @@ build-images: build-controller-image build-agones-sdk-image
build-sdks: build-sdk-cpp

# Run all tests
test: ensure-build-image
test: ensure-build-image test-go test-install-yaml

# Run go tests
test-go:
docker run --rm $(common_mounts) $(build_tag) go test -race $(agones_package)/...

# Run test on install yaml - make sure there is no change
# mostly this is for CI
test-install-yaml:
-mkdir -p /tmp/agones-install
cp $(agones_path)/install/yaml/install.yaml /tmp/agones-install/install.yaml
sort /tmp/agones-install/install.yaml > /tmp/agones-install/install.yaml.sort
$(MAKE) gen-install
sort $(agones_path)/install/yaml/install.yaml > /tmp/agones-install/install.current.yaml.sorted
diff /tmp/agones-install/install.yaml.sort /tmp/agones-install/install.current.yaml.sorted

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

Expand Down Expand Up @@ -149,6 +162,11 @@ build-sdk-cpp: ensure-build-image
push-agones-sdk-image: ensure-build-image
docker push $(sidecar_tag)

# 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 $(mount_path)/install/helm/agones > $(mount_path)/install/yaml/install.yaml'

# Generate the SDK gRPC server and client code
gen-gameservers-sdk-grpc: ensure-build-image
docker run --rm $(common_mounts) -w $(mount_path) $(build_tag) /root/gen-grpc-go.sh
Expand Down
3 changes: 3 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ Compile the gameserver controller and then build the docker image
#### `make build-agones-sdk-image`
Compile the gameserver sidecar and then build the docker image

#### `make gen-install`
Generate the `/install/yaml/install.yaml` from the Helm template

#### `make gen-crd-client`
Generate the Custom Resource Definition client(s)

Expand Down
Loading

0 comments on commit 81a4c2b

Please sign in to comment.