Skip to content

Commit

Permalink
Use kustomize to generate a single CRDs file
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Apr 26, 2024
1 parent b37071d commit eb5b001
Show file tree
Hide file tree
Showing 10 changed files with 1,327 additions and 38 deletions.
6 changes: 1 addition & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ milestones:
snapshot:
name_template: "edge"

before:
hooks:
- make crds-release-file

release:
extra_files:
- glob: ./build/out/crds.yaml
- glob: ./deploy/crds.yaml
- glob: ./deploy/manifests/nginx-gateway.yaml
- glob: ./deploy/manifests/nginx-plus-gateway.yaml
- glob: ./deploy/manifests/nginx-gateway-experimental.yaml
Expand Down
1 change: 1 addition & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yaml-files:
ignore:
- charts/nginx-gateway-fabric
- config/crd/bases/
- deploy/crds.yaml
- .github/workflows/

rules:
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ generate: ## Run go generate
.PHONY: generate-crds
generate-crds: ## Generate CRDs and Go types using kubebuilder
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd object paths=./apis/... output:crd:artifacts:config=config/crd/bases
@kustomize version || (code=$$?; printf "\033[0;31mError\033[0m: there was a problem with kustomize, use 'brew install kustomize' to install it\n"; exit $$code)
kustomize build config/crd >deploy/crds.yaml

.PHONY: generate-manifests
generate-manifests: ## Generate manifests using Helm.
Expand All @@ -113,10 +115,6 @@ generate-manifests: ## Generate manifests using Helm.
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
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

.PHONY: crds-release-file
crds-release-file: ## Generate combined crds file for releases
scripts/combine-crds.sh

.PHONY: clean
clean: ## Clean the build
-rm -r $(OUT_DIR)
Expand Down
5 changes: 5 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- bases/gateway.nginx.org_clientsettingspolicies.yaml
- bases/gateway.nginx.org_nginxgateways.yaml
- bases/gateway.nginx.org_nginxproxies.yaml
- bases/gateway.nginx.org_observabilitypolicies.yaml
5 changes: 2 additions & 3 deletions conformance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ KIND_KUBE_CONFIG=$${HOME}/.kube/kind/config
CONFORMANCE_TAG = latest
CONFORMANCE_PREFIX = conformance-test-runner
NGF_MANIFEST=../deploy/manifests/nginx-gateway.yaml
CRDS=../deploy/manifests/crds/
STATIC_MANIFEST=provisioner/static-deployment.yaml
PROVISIONER_MANIFEST=provisioner/provisioner.yaml
INSTALL_WEBHOOK ?= false
Expand Down Expand Up @@ -63,13 +62,13 @@ load-images-with-plus: ## Load NGF and NGINX Plus images on configured kind clus
.PHONY: prepare-ngf-dependencies
prepare-ngf-dependencies: update-ngf-manifest ## Install NGF dependencies on configured kind cluster
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK) $(ENABLE_EXPERIMENTAL)
kubectl apply -f $(CRDS)
kustomize build ../config/crd/bases | kubectl apply -f -
kubectl apply -f $(NGF_MANIFEST)

.PHONY: prepare-ngf-dependencies-with-plus
prepare-ngf-dependencies-with-plus: update-ngf-manifest-with-plus ## Install NGF dependencies with Plus on configured kind cluster
./scripts/install-gateway.sh $(GW_API_VERSION) $(INSTALL_WEBHOOK)
kubectl apply -f $(CRDS)
kustomize build ../config/crd/bases | kubectl apply -f -
kubectl apply -f $(NGF_MANIFEST)

.PHONY: deploy-updated-provisioner
Expand Down
1,309 changes: 1,309 additions & 0 deletions deploy/crds.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion deploy/manifests/crds

This file was deleted.

6 changes: 3 additions & 3 deletions docs/developer/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ This will build the docker images `nginx-gateway-fabric:<your-user>` and `nginx-

```shell
make generate-manifests HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=nginx-gateway-fabric --set nginxGateway.image.tag=$(whoami) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=nginx-gateway-fabric/nginx --set nginx.image.tag=$(whoami) --set nginx.image.pullPolicy=Never"
kubectl apply -f deploy/manifests/crds
kubectl apply -f deploy/crds.yaml
kubectl apply -f deploy/manifests/nginx-gateway.yaml
kubectl apply -f deploy/manifests/service/nodeport.yaml
```
Expand All @@ -163,7 +163,7 @@ This will build the docker images `nginx-gateway-fabric:<your-user>` and `nginx-

```shell
make generate-manifests HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=nginx-gateway-fabric --set nginxGateway.image.tag=$(whoami) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=nginx-gateway-fabric/nginx-plus --set nginx.image.tag=$(whoami) --set nginx.image.pullPolicy=Never --set nginx.plus=true"
kubectl apply -f deploy/manifests/crds
kubectl apply -f deploy/crds.yaml
kubectl apply -f deploy/manifests/nginx-gateway.yaml
kubectl apply -f deploy/manifests/service/nodeport.yaml
```
Expand All @@ -172,7 +172,7 @@ This will build the docker images `nginx-gateway-fabric:<your-user>` and `nginx-

```shell
make generate-manifests HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=nginx-gateway-fabric --set nginxGateway.image.tag=$(whoami) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=nginx-gateway-fabric/nginx --set nginx.image.tag=$(whoami) --set nginx.image.pullPolicy=Never"
kubectl apply -f deploy/manifests/crds
kubectl apply -f deploy/crds.yaml
kubectl apply -f deploy/manifests/nginx-gateway-experimental.yaml
kubectl apply -f deploy/manifests/service/nodeport.yaml
```
Expand Down
13 changes: 0 additions & 13 deletions scripts/combine-crds.sh

This file was deleted.

13 changes: 4 additions & 9 deletions site/content/installation/installing-ngf/manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ Deploying NGINX Gateway Fabric with Kubernetes manifests takes only a few steps.
#### Stable release

```shell
kubectl apply -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/crds.yaml
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
```

#### Edge version

```shell
git clone https://github.com/nginxinc/nginx-gateway-fabric.git
cd nginx-gateway-fabric
```

```shell
kubectl apply -f deploy/manifests/crds
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/main/deploy/crds.yaml
```

### 3. Deploy NGINX Gateway Fabric
Expand Down Expand Up @@ -164,7 +159,7 @@ To upgrade NGINX Gateway Fabric and get the latest features and improvements, ta
- To upgrade the Custom Resource Definitions (CRDs), run:

```shell
kubectl apply -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/crds.yaml
kubectl apply -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
```

1. **Upgrade NGINX Gateway Fabric deployment:**
Expand Down Expand Up @@ -238,7 +233,7 @@ Follow these steps to uninstall NGINX Gateway Fabric and Gateway API from your K
```

```shell
kubectl delete -f https://github.com/nginxinc/nginx-gateway-fabric/releases/download/v1.2.0/crds.yaml
kubectl delete -f https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/v1.2.0/deploy/crds.yaml
```

1. **Remove the Gateway API resources:**
Expand Down

0 comments on commit eb5b001

Please sign in to comment.