Skip to content

Commit c98b2fa

Browse files
authored
Add deployment manifests as release artifacts (#1092)
Problem: As a user, I want an easy way to install the NGF manifests. Currently, I have to clone the repository. Solution: By including the manifests as part of a release, the repo no longer has to be cloned to install NGF. Note: the service definitions are not uploaded and therefore still require a clone if they are to be installed.
1 parent 497eab6 commit c98b2fa

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

.goreleaser.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,12 @@ milestones:
5555

5656
snapshot:
5757
name_template: 'edge'
58+
59+
before:
60+
hooks:
61+
- make crds-release-file
62+
63+
release:
64+
extra_files:
65+
- glob: ./build/out/crds.yaml
66+
- glob: ./deploy/manifests/nginx-gateway.yaml

Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ generate-crds: ## Generate CRDs and Go types using kubebuilder
6767
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd paths=./apis/... output:crd:dir=deploy/helm-chart/crds
6868
go run sigs.k8s.io/controller-tools/cmd/controller-gen object paths=./apis/...
6969

70+
.PHONY: generate-manifests
71+
generate-manifests: ## Generate manifests using Helm.
72+
cp $(CHART_DIR)/crds/* $(MANIFEST_DIR)/crds/
73+
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-gateway.yaml
74+
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set metrics.enable=false -n nginx-gateway -s templates/deployment.yaml > conformance/provisioner/static-deployment.yaml
75+
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer.yaml
76+
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.annotations.'service\.beta\.kubernetes\.io\/aws-load-balancer-type'="nlb" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer-aws-nlb.yaml
77+
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.type=NodePort --set service.externalTrafficPolicy="" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/nodeport.yaml
78+
79+
.PHONY: crds-release-file
80+
crds-release-file: ## Generate combined crds file for releases
81+
scripts/combine-crds.sh
82+
7083
.PHONY: clean
7184
clean: ## Clean the build
7285
-rm -r $(OUT_DIR)
@@ -132,14 +145,5 @@ debug-build: build ## Build binary with debug info, symbols, and no optimization
132145
.PHONY: build-ngf-debug-image
133146
build-ngf-debug-image: debug-build build-ngf-image ## Build NGF image with debug binary
134147

135-
.PHONY: generate-manifests
136-
generate-manifests: ## Generate manifests using Helm.
137-
cp $(CHART_DIR)/crds/* $(MANIFEST_DIR)/crds/
138-
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) -n nginx-gateway | cat $(strip $(MANIFEST_DIR))/namespace.yaml - > $(strip $(MANIFEST_DIR))/nginx-gateway.yaml
139-
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set metrics.enable=false -n nginx-gateway -s templates/deployment.yaml > conformance/provisioner/static-deployment.yaml
140-
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer.yaml
141-
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.annotations.'service\.beta\.kubernetes\.io\/aws-load-balancer-type'="nlb" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/loadbalancer-aws-nlb.yaml
142-
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.type=NodePort --set service.externalTrafficPolicy="" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/nodeport.yaml
143-
144148
.PHONY: dev-all
145149
dev-all: deps fmt njs-fmt vet lint unit-test njs-unit-test ## Run all the development checks

scripts/combine-crds.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
mkdir -p build/out
4+
5+
CRD_FILE=build/out/crds.yaml
6+
echo "# NGINX Gateway API CustomResourceDefinitions" > ${CRD_FILE}
7+
8+
for file in `ls deploy/manifests/crds/*.yaml`; do
9+
echo "#" >> ${CRD_FILE}
10+
echo "# $file" >> ${CRD_FILE}
11+
echo "#" >> ${CRD_FILE}
12+
cat $file >> ${CRD_FILE}
13+
done

0 commit comments

Comments
 (0)