Skip to content

Commit de47ec1

Browse files
xWinkShawn Kaplan
andauthored
Added automatic api reference generation (#507)
Co-authored-by: Shawn Kaplan <kapshawn@amazon.com>
1 parent 1fd61c1 commit de47ec1

File tree

15 files changed

+1700
-16
lines changed

15 files changed

+1700
-16
lines changed

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
export KUBEBUILDER_ASSETS ?= ${HOME}/.kubebuilder/bin
2-
export CLUSTER_NAME ?= $(shell kubectl config view --minify -o jsonpath='{.clusters[].name}' | rev | cut -d"/" -f1 | rev | cut -d"." -f1)
3-
export CLUSTER_VPC_ID ?= $(shell aws eks describe-cluster --name $(CLUSTER_NAME) | jq -r ".cluster.resourcesVpcConfig.vpcId")
4-
export AWS_ACCOUNT_ID ?= $(shell aws sts get-caller-identity --query Account --output text)
5-
export REGION ?= $(shell aws configure get region)
1+
# For all targets except `help` and default target (which is also `help`), export environment variables
2+
ifneq (,$(filter-out help,$(MAKECMDGOALS)))
3+
export KUBEBUILDER_ASSETS ?= ${HOME}/.kubebuilder/bin
4+
export CLUSTER_NAME ?= $(shell kubectl config view --minify -o jsonpath='{.clusters[].name}' | rev | cut -d"/" -f1 | rev | cut -d"." -f1)
5+
export CLUSTER_VPC_ID ?= $(shell aws eks describe-cluster --name $(CLUSTER_NAME) | jq -r ".cluster.resourcesVpcConfig.vpcId")
6+
export AWS_ACCOUNT_ID ?= $(shell aws sts get-caller-identity --query Account --output text)
7+
export REGION ?= $(shell aws configure get region)
8+
endif
9+
610
# Image URL to use all building/pushing image targets
711
IMG ?= controller:latest
812
VERSION ?= $(shell git tag --sort=v:refname | tail -1)
@@ -115,3 +119,9 @@ e2e-clean: ## Delete eks resources created in the e2e test namespace
115119
@kubectl delete namespace $(e2e-test-namespace) > /dev/null 2>&1
116120
@kubectl create namespace $(e2e-test-namespace) > /dev/null 2>&1
117121
@echo "Done!"
122+
123+
.PHONY: api-reference
124+
api-reference: ## Update documentation in docs/api-reference.md
125+
@cd docgen && \
126+
gen-crd-api-reference-docs -config config.json -api-dir "../pkg/apis/applicationnetworking/v1alpha1/" -out-file docs.html && \
127+
cat api-reference-base.md docs.html > ../docs/api-reference.md

docgen/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Install doc generator
44

55
```sh
6-
go install github.com/ahmetb/gen-crd-api-reference-docs
6+
go install github.com/ahmetb/gen-crd-api-reference-docs@v0.3.0
77
```
88

99
Generate html docs

docgen/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"List$"
88
],
99
"externalPackages": [
10+
{
11+
"typeMatchPrefix": "^sigs\\.k8s\\.io/gateway-api/apis/v1alpha2\\.PolicyTargetReference",
12+
"docsURLTemplate": "https://gateway-api.sigs.k8s.io/geps/gep-713/?h=policytargetreference#policy-targetref-api"
13+
},
1014
{
1115
"typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Duration$",
1216
"docsURLTemplate": "https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration"

0 commit comments

Comments
 (0)