Skip to content

Commit 7c637e0

Browse files
committed
Moving reference docs gen to elastic/crd-ref-docs
1 parent 99bdfef commit 7c637e0

File tree

11 files changed

+98
-22
lines changed

11 files changed

+98
-22
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ updates:
5454

5555
# Dependencies listed in requirements.txt
5656
- package-ecosystem: "pip"
57-
directory: "/"
57+
directory: "/hack/mkdocs/image"
5858
schedule:
5959
interval: "weekly"
6060
labels:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ go.work.sum
5656
/cache
5757
.venv/
5858
release/
59+
site-src/reference/spec.md

Makefile

+25-12
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ test.crds-validation:
9191
.PHONY: conformance
9292
conformance:
9393
go test ${GO_TEST_FLAGS} -v ./conformance -run TestConformance -args ${CONFORMANCE_FLAGS}
94-
94+
9595
# Install CRD's and example resources to a preexisting cluster.
9696
.PHONY: install
9797
install: crd example
@@ -159,14 +159,27 @@ image.multiarch.setup: image.buildx.verify
159159
release-staging: image.multiarch.setup
160160
hack/build-and-push.sh
161161

162-
# Generate a virtualenv install, which is useful for hacking on the
163-
# docs since it installs mkdocs and all the right dependencies.
164-
#
165-
# On Ubuntu, this requires the python3-venv package.
166-
virtualenv: .venv
167-
.venv: requirements.txt
168-
@echo Creating a virtualenv in $@"... "
169-
@python3 -m venv $@ || (rm -rf $@ && exit 1)
170-
@echo Installing packages in $@"... "
171-
@$@/bin/python3 -m pip install -q -r requirements.txt || (rm -rf $@ && exit 1)
172-
@echo To enter the virtualenv type \"source $@/bin/activate\", to exit type \"deactivate\"
162+
# Docs
163+
164+
.PHONY: build-docs
165+
build-docs:
166+
docker build --pull -t gaie/mkdocs hack/mkdocs/image
167+
docker run --rm -v ${PWD}:/docs gaie/mkdocs build
168+
169+
.PHONY: build-docs-netlify
170+
build-docs-netlify: api-ref-docs
171+
pip install -r hack/mkdocs/image/requirements.txt
172+
python -m mkdocs build
173+
174+
.PHONY: live-docs
175+
live-docs:
176+
docker build -t gw/mkdocs hack/mkdocs/image
177+
docker run --rm -it -p 3000:3000 -v ${PWD}:/docs gw/mkdocs
178+
179+
.PHONY: api-ref-docs
180+
api-ref-docs:
181+
crd-ref-docs \
182+
--source-path=${PWD}/apis \
183+
--config=crd-ref-docs.yaml \
184+
--renderer=markdown \
185+
--output-path=${PWD}/site-src/reference/spec.md

crd-ref-docs.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file contains configuration for our reference docs generation. For more
2+
# information about the possible configuration, refer to
3+
# https://github.com/elastic/crd-ref-docs.
4+
5+
processor:
6+
ignoreTypes:
7+
- "()List$"
8+
# RE2 regular expressions describing type fields that should be excluded from the generated documentation.
9+
ignoreFields:
10+
- "TypeMeta$"
11+
12+
render:
13+
# Version of Kubernetes to use when generating links to Kubernetes API documentation.
14+
kubernetesVersion: 1.32

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module sigs.k8s.io/gateway-api
33
go 1.24.0
44

55
require (
6-
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
6+
github.com/elastic/crd-ref-docs v0.1.0
77
github.com/miekg/dns v1.1.63
88
github.com/stretchr/testify v1.10.0
99
golang.org/x/net v0.35.0

hack/mkdocs/image/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2019 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM python:3.12
16+
17+
COPY requirements.txt /requirements.txt
18+
RUN pip install -r /requirements.txt
19+
20+
WORKDIR /docs
21+
22+
EXPOSE 3000
23+
24+
COPY entrypoint.sh /
25+
26+
ENTRYPOINT ["/entrypoint.sh"]

hack/mkdocs/image/entrypoint.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
19+
CMD=$1
20+
21+
if [ "$CMD" == "build" ];
22+
then
23+
mkdocs build
24+
exit 0;
25+
fi
26+
27+
mkdocs serve --dev-addr=0.0.0.0:3000 --livereload

requirements.txt hack/mkdocs/image/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ pymdown-extensions==10.14.3
2020
PyYAML==6.0.2
2121
six==1.17.0
2222
tabulate==0.9.0
23-
tornado==6.4.2
23+
tornado==6.4.2

netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Netlify build instructions
22
[build]
3-
command = "make docs"
3+
command = "make build-docs-netlify"
44
publish = "site"
55
[build.environment]
66
PYTHON_VERSION = "3.12"

site-src/reference/spec.md

-5
This file was deleted.

tools/tools.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ limitations under the License.
2323
package tools
2424

2525
import (
26-
_ "github.com/ahmetb/gen-crd-api-reference-docs"
26+
_ "github.com/elastic/crd-ref-docs"
2727
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
2828
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
2929
_ "k8s.io/code-generator/cmd/client-gen"

0 commit comments

Comments
 (0)