Skip to content

Commit cd85ffe

Browse files
committed
Generate the install.yaml from helm template
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 agones-dev#170, Parent ticket: agones-dev#101
1 parent 794dcdb commit cd85ffe

3 files changed

Lines changed: 287 additions & 112 deletions

File tree

build/Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,22 @@ build-images: build-controller-image build-agones-sdk-image
9898
build-sdks: build-sdk-cpp
9999

100100
# Run all tests
101-
test: ensure-build-image
101+
test: ensure-build-image test-go test-install-yaml
102+
103+
# Run go tests
104+
test-go:
102105
docker run --rm $(common_mounts) $(build_tag) go test -race $(agones_package)/...
103106

107+
# Run test on install yaml - make sure there is no change
108+
# mostly this is for CI
109+
test-install-yaml:
110+
-mkdir -p /tmp/agones-install
111+
cp $(agones_path)/install/yaml/install.yaml /tmp/agones-install/install.yaml
112+
sort /tmp/agones-install/install.yaml > /tmp/agones-install/install.yaml.sorted
113+
$(MAKE) gen-install
114+
sort $(agones_path)/install/yaml/install.yaml > /tmp/agones-install/install.current.yaml.sorted
115+
diff /tmp/agones-install/install.yaml.sorted /tmp/agones-install/install.current.yaml.sorted
116+
104117
# Push all the images up to $(REGISTRY)
105118
push: push-controller-image push-agones-sdk-image
106119

@@ -149,6 +162,11 @@ build-sdk-cpp: ensure-build-image
149162
push-agones-sdk-image: ensure-build-image
150163
docker push $(sidecar_tag)
151164

165+
# Generate the static install script
166+
gen-install: ensure-build-image
167+
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \
168+
'helm template --name=agones-manual $(mount_path)/install/helm/agones > $(mount_path)/install/yaml/install.yaml'
169+
152170
# Generate the SDK gRPC server and client code
153171
gen-gameservers-sdk-grpc: ensure-build-image
154172
docker run --rm $(common_mounts) -w $(mount_path) $(build_tag) /root/gen-grpc-go.sh

build/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ Compile the gameserver controller and then build the docker image
275275
#### `make build-agones-sdk-image`
276276
Compile the gameserver sidecar and then build the docker image
277277

278+
#### `make gen-install`
279+
Generate the `/install/yaml/install.yaml` from the Helm template
280+
278281
#### `make gen-crd-client`
279282
Generate the Custom Resource Definition client(s)
280283

0 commit comments

Comments
 (0)