Skip to content

Commit f908851

Browse files
authored
Add Gateway API CRDs to the repo with kustomize (#2011)
Problem: We don't have a way to tie a version of the Gateway API to our release (or edge). There's also not a single source of truth for the API version. Solution: Use kustomize to add a specific version of the CRDs to our codebase. This way we only have to manage the version in one place and we can tie it to our releases.
1 parent f4c6723 commit f908851

File tree

16 files changed

+68
-100
lines changed

16 files changed

+68
-100
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ jobs:
309309
make create-kind-cluster KIND_KUBE_CONFIG=${kube_config}
310310
echo "KUBECONFIG=${kube_config}" >> "$GITHUB_ENV"
311311
kind load docker-image ghcr.io/nginxinc/nginx-gateway-fabric:${{ steps.ngf-meta.outputs.version }} ghcr.io/nginxinc/nginx-gateway-fabric/nginx:${{ steps.nginx-meta.outputs.version }}
312-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
312+
kubectl kustomize config/crd/gateway-api/standard | kubectl apply -f -
313313
314314
- name: Install Chart
315315
run: >

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ TELEMETRY_REPORT_PERIOD = 24h
1717
TELEMETRY_ENDPOINT=# if empty, NGF will report telemetry in its logs at debug level.
1818
TELEMETRY_ENDPOINT_INSECURE = false
1919

20-
GW_API_VERSION = 1.1.0
2120
ENABLE_EXPERIMENTAL ?= false
2221
NODE_VERSION = $(shell cat .nvmrc)
2322

@@ -112,15 +111,15 @@ generate-crds: ## Generate CRDs and Go types using kubebuilder
112111

113112
.PHONY: install-crds
114113
install-crds: ## Install CRDs
115-
kubectl kustomize config/crd | kubectl apply -f -
114+
kubectl kustomize $(SELF_DIR)config/crd | kubectl apply -f -
116115

117116
.PHONY: install-gateway-crds
118117
install-gateway-crds: ## Install Gateway API CRDs
119-
$(SELF_DIR)tests/scripts/install-gateway.sh $(GW_API_VERSION) $(ENABLE_EXPERIMENTAL)
118+
kubectl kustomize $(SELF_DIR)config/crd/gateway-api/$(if $(filter true,$(ENABLE_EXPERIMENTAL)),experimental,standard) | kubectl apply -f -
120119

121120
.PHONY: uninstall-gateway-crds
122121
uninstall-gateway-crds: ## Uninstall Gateway API CRDs
123-
$(SELF_DIR)tests/scripts/uninstall-gateway.sh $(GW_API_VERSION) $(ENABLE_EXPERIMENTAL)
122+
kubectl kustomize $(SELF_DIR)config/crd/gateway-api/$(if $(filter true,$(ENABLE_EXPERIMENTAL)),experimental,standard) | kubectl delete -f -
124123

125124
.PHONY: generate-manifests
126125
generate-manifests: ## Generate manifests using Helm.

charts/nginx-gateway-fabric/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This chart deploys the NGINX Gateway Fabric in your Kubernetes cluster.
4040
> [see the Technical Specifications](https://github.com/nginxinc/nginx-gateway-fabric/blob/main/README.md#technical-specifications).
4141
4242
```shell
43-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
43+
kubectl kustomize https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/standard | kubectl apply -f -
4444
```
4545

4646
## Installing the Chart
@@ -128,7 +128,7 @@ Gateway Fabric - [see the Technical Specifications](../../README.md#technical-sp
128128
To upgrade the Gateway CRDs from [the Gateway API repo](https://github.com/kubernetes-sigs/gateway-api), run:
129129

130130
```shell
131-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
131+
kubectl kustomize https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/standard | kubectl apply -f -
132132
```
133133

134134
### Upgrading the CRDs
@@ -238,7 +238,7 @@ These commands remove all the Kubernetes components associated with the release
238238
To delete the Gateway API CRDs from [the Gateway API repo](https://github.com/kubernetes-sigs/gateway-api), run:
239239

240240
```shell
241-
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
241+
kubectl kustomize https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/standard | kubectl delete -f -
242242
```
243243

244244
## Configuration
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- https://github.com/kubernetes-sigs/gateway-api/config/crd/experimental?timeout=120&ref=v1.1.0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- https://github.com/kubernetes-sigs/gateway-api/config/crd?timeout=120&ref=v1.1.0

config/crd/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
13
resources:
24
- bases/gateway.nginx.org_clientsettingspolicies.yaml
35
- bases/gateway.nginx.org_nginxgateways.yaml

docs/developer/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ This will build the docker images `nginx-gateway-fabric:<your-user>` and `nginx-
133133
3. Install Gateway API CRDs:
134134

135135
```shell
136-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
136+
kubectl kustomize config/crd/gateway-api/standard | kubectl apply -f -
137137
```
138138

139139
If you're implementing experimental Gateway API features, install Gateway API CRDs from the experimental channel:
140140

141141
```shell
142-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/experimental-install.yaml
142+
kubectl kustomize config/crd/gateway-api/experimental | kubectl apply -f -
143143
```
144144

145145
4. Install NGF using your custom image and expose NGF with a NodePort Service:

docs/developer/release-process.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ To create a new release, follow these steps:
3737
7. Create a release branch following the `release-X.Y` naming convention.
3838
8. Run the [Release PR](./../../.github/workflows/release-pr.yml) workflow to update the repo files for the release. Then there are a few manual steps to complete:
3939
1. Update the tag of NGF container images used in the [provisioner manifest](/tests/conformance/provisioner/provisioner.yaml).
40-
2. Update any installation instructions to ensure that the supported Gateway API is correct.
41-
Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`.
42-
3. Update the [README](/README.md) to include information about the release.
43-
4. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly.
40+
2. Update the [README](/README.md) to include information about the release.
41+
3. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly.
4442
The changelog includes only important (from the user perspective)
4543
changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next
4644
step. As a starting point, copy the important features, bug fixes, and dependencies from the autogenerated
@@ -51,14 +49,13 @@ To create a new release, follow these steps:
5149
- Build NGF, NGINX and NGINX Plus container images with the release tag `X.Y.Z` and push them to the registries.
5250
- Package and publish the Helm chart to the registry.
5351
- Create a GitHub release with an autogenerated changelog and attached release artifacts.
54-
10. Prepare and merge a PR into the main branch to update with similar information that you did in the release
55-
branch docs PR. Specifically:
56-
1. [README](/README.md) to include the information about the latest release.
57-
2. [changelog](/CHANGELOG.md).
58-
3. Helm chart `version` field.
59-
4. `VERSION` in top-level Makefile.
60-
5. Any references in the docs to the previous release.
61-
6. Any installation instructions to ensure that the supported Gateway API and NGF versions are correct.Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`.
52+
10. Prepare and merge a PR into the main branch to update with similar information that you did in the release branch docs PR. Specifically:
53+
1. [README](/README.md) to include the information about the latest release.
54+
2. [changelog](/CHANGELOG.md).
55+
3. Helm chart `version` field.
56+
4. `VERSION` in top-level Makefile.
57+
5. Any references in the docs to the previous release.
58+
6. Any installation instructions to ensure that the supported Gateway API and NGF versions are correct. Specifically, helm README.
6259
11. Ask the docs team to update the production branch for NGF in Netlify to our latest release branch and run the deployment pipeline.
6360
12. Close the issue created in Step 1.
6461
13. Ensure that the [associated milestone](https://github.com/nginxinc/nginx-gateway-fabric/milestones) is closed.

site/content/includes/installation/install-gateway-api-resources.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ docs: "DOCS-1438"
77
To install the Gateway API resources, run the following:
88

99
```shell
10-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
10+
kubectl kustomize "https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=v1.2.0" | kubectl apply -f -
1111
```
1212

13+
{{<note>}}If you plan to use the `edge` version of NGINX Gateway Fabric, you can replace the vesion in `ref` with `main`, for example `ref=main`.{{</note>}}
14+
1315
Alternatively, you can install the Gateway API resources from the experimental channel. We support a subset of the
1416
additional features provided by the experimental channel. To install from the experimental channel, run the following:
1517

1618
```shell
17-
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/experimental-install.yaml
19+
kubectl kustomize "https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/experimental?ref=v1.2.0" | kubectl apply -f -
1820
```

site/content/includes/installation/uninstall-gateway-api-resources.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
docs: "DOCS-1436"
33
---
44

5-
{{<warning>}}This will remove all corresponding custom resources in your entire cluster, across all namespaces. Double-check to make sure you don't have any custom resources you need to keep, and confirm that there are no other Gateway API implementations active in your cluster.{{</warning>}}
5+
{{<warning>}}This will remove all corresponding custom resources in your entire cluster, across all namespaces. Double-check to make sure you don't have any custom resources you need to keep, and confirm that there are no other Gateway API implementations active in your cluster.{{</warning>}}
66

7-
To uninstall the Gateway API resources, run the following:
7+
To uninstall the Gateway API resources, run the following:
88

9-
```shell
10-
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml
11-
```
9+
```shell
10+
kubectl kustomize "https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/experimental?ref=v1.2.0" | kubectl delete -f -
11+
```
1212

13-
Alternatively, if you installed the Gateway APIs from the experimental channel, run the following:
13+
Alternatively, if you installed the Gateway APIs from the experimental channel, run the following:
1414

15-
```shell
16-
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/experimental-install.yaml
17-
```
15+
```shell
16+
kubectl kustomize "https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/experimental?ref=v1.2.0" | kubectl delete -f -
17+
```

0 commit comments

Comments
 (0)