-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Agones Kubernetes API docs generator #645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
# | ||
# Website targets | ||
# | ||
|
||
# generate the latest website | ||
site-server: ARGS ?=-F | ||
site-server: ENV ?= RELEASE_VERSION="$(base_version)" RELEASE_BRANCH=master | ||
|
@@ -59,6 +59,24 @@ site-deploy-preview: site-static-preview | |
|
||
site-test: | ||
# generate actual html and run test against - provides a more accurate tests | ||
$(MAKE) test-gen-api-docs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a good answer for this - but because the website works off master - if we change our CRD data structures, that will change the website as well, and be out of sync until next release. Only idea I've got - that in the advent of that happening - rename the old page and put an I'm just thinking out loud here, but any ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried to use custom short code in front-matter and it seems that variables are not supported there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds fancy - but makes sense to me! I assume you can make that work? 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated |
||
$(MAKE) site-static-preview | ||
docker run --rm -t -e "TERM=xterm-256color" $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \ | ||
"mkdir -p /tmp/website && cp -r $(mount_path)/site/public /tmp/website/site && htmltest -c $(mount_path)/site/htmltest.yaml /tmp/website" | ||
"mkdir -p /tmp/website && cp -r $(mount_path)/site/public /tmp/website/site && htmltest -c $(mount_path)/site/htmltest.yaml /tmp/website" | ||
|
||
# Path to a file and docker command | ||
REL_PATH := content/en/docs/Reference/agones_crd_api_reference.html | ||
GEN_API_DOCS := docker run -e FILE="$(mount_path)/site/$(REL_PATH)" -e VERSION=${base_version} --rm -i $(common_mounts) $(build_tag) bash -c "/go/src/agones.dev/agones/site/gen-api-docs.sh" | ||
|
||
# generate Agones CRD reference docs | ||
gen-api-docs: ensure-build-image | ||
$(GEN_API_DOCS) | ||
|
||
# test generated Agones CRD reference docs | ||
test-gen-api-docs: expected_docs := $(site_path)/$(REL_PATH) | ||
test-gen-api-docs: ensure-build-image | ||
cp $(expected_docs) /tmp/generated.html | ||
sort /tmp/generated.html > /tmp/generated.html.sorted | ||
$(GEN_API_DOCS) | ||
sort $(expected_docs) > /tmp/result.sorted | ||
diff -bB /tmp/result.sorted /tmp/generated.html.sorted |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{{ define "packages" }} | ||
|
||
{{ with .packages}} | ||
<p>Packages:</p> | ||
<ul> | ||
{{ range . }} | ||
<li> | ||
<a href="#{{- packageDisplayName . -}}">{{ packageDisplayName . }}</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
{{ end}} | ||
|
||
{{ range .packages }} | ||
<h2 id="{{- packageDisplayName . -}}"> | ||
{{- packageDisplayName . -}} | ||
</h2> | ||
|
||
{{ with .DocComments }} | ||
<p> | ||
{{ safe (renderComments .) }} | ||
</p> | ||
{{ end }} | ||
|
||
Resource Types: | ||
<ul> | ||
{{- range (visibleTypes (sortedTypes .Types)) -}} | ||
{{ if isExportedType . -}} | ||
<li> | ||
<a href="#{{ typeIdentifier . }}">{{ typeIdentifier . }}</a> | ||
</li> | ||
{{- end }} | ||
{{- end -}} | ||
</ul> | ||
|
||
{{ range (visibleTypes (sortedTypes .Types))}} | ||
{{ template "type" . }} | ||
{{ end }} | ||
<hr/> | ||
{{ end }} | ||
|
||
<p><em> | ||
Generated with <code>gen-crd-api-reference-docs</code>. | ||
</em></p> | ||
|
||
{{ end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,11 @@ description: > | |
--- | ||
|
||
Installing Agones creates several [Custom Resource Definitions (CRD)](https://kubernetes.io/docs/concepts/api-extension/custom-resources), | ||
which can be accessed and manipulated through the Kubernetes API. | ||
which can be accessed and manipulated through the Kubernetes API. | ||
|
||
{{% feature publishVersion="0.9.0" %}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the CRDs have changed - could we publish this all now? (0.8.0?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated publishVersion, test still pass. |
||
The detailed list of Agones CRDs with their parameters could be found here - [Agones CRD API Reference](../../reference/agones_crd_api_reference/). | ||
{{% /feature %}} | ||
|
||
Kubernetes has multiple [client libraries](https://kubernetes.io/docs/reference/using-api/client-libraries/), however, | ||
at time of writing, only | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should probably pin to a commit here.
Given there's a copy of the template in this repo, I don't want to accidentally break the downstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ahmetb for the review. I was thinking about that, will provide an update in a separate PR.