From fe0c1e3683a32fcd94ebb229ea84fb399db1aade Mon Sep 17 00:00:00 2001 From: Sanket Sudake Date: Tue, 30 Nov 2021 15:54:53 +0530 Subject: [PATCH] Add support for generating CRD docs (#2273) * Add support for generating CRD docs * Correct typos in custom resource definitions Signed-off-by: Sanket Sudake --- Makefile | 7 +++++ crds/v1/fission.io_environments.yaml | 2 +- crds/v1/fission.io_functions.yaml | 4 +-- crds/v1/fission.io_httptriggers.yaml | 6 ++-- crds/v1/fission.io_packages.yaml | 4 +-- hack/update-swagger-docs.sh | 2 +- pkg/apis/core/v1/doc.go | 4 --- pkg/apis/core/v1/types.go | 20 ++++++------ .../v1/zz_generated.swagger_doc_generated.go | 31 +++++-------------- tools/crd-ref-docs/config.yaml | 7 +++++ tools/crd-ref-docs/header.md | 7 +++++ 11 files changed, 48 insertions(+), 46 deletions(-) create mode 100644 tools/crd-ref-docs/config.yaml create mode 100644 tools/crd-ref-docs/header.md diff --git a/Makefile b/Makefile index ab4d27e9..21bc89c5 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,13 @@ generate-swagger-doc: generate-cli-docs: go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/fission-cli" +generate-crd-ref-docs: + # crd-ref-docs: https://github.com/elastic/crd-ref-docs + crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown + cp tools/crd-ref-docs/header.md crd_docs.md + cat out.md >> crd_docs.md && rm out.md + cp crd_docs.md ../fission.io/content/en/docs/crd/_index.md + all-generators: codegen generate-crds generate-swagger-doc skaffold-prebuild: diff --git a/crds/v1/fission.io_environments.yaml b/crds/v1/fission.io_environments.yaml index f9cc0ba2..2cbb285b 100644 --- a/crds/v1/fission.io_environments.yaml +++ b/crds/v1/fission.io_environments.yaml @@ -9399,7 +9399,7 @@ spec: format: int64 type: integer version: - description: "Version is the Environment API version \n Version \"1\" allows user to run code snippet in a file and it's supported by most of environments except tensorflow-serving. \n Version \"2\" supports downloading and compiling user function if source archive is not empty. \n Version \"3\" is almost the same with v2, but you're able to control the size of pre-warm pool of the environment." + description: "Version is the Environment API version \n Version \"1\" allows user to run code snippet in a file, and it's supported by most of the environments except tensorflow-serving. \n Version \"2\" supports downloading and compiling user function if source archive is not empty. \n Version \"3\" is almost the same with v2, but you're able to control the size of pre-warm pool of the environment." type: integer required: - runtime diff --git a/crds/v1/fission.io_functions.yaml b/crds/v1/fission.io_functions.yaml index 54baeb95..545bcf3d 100644 --- a/crds/v1/fission.io_functions.yaml +++ b/crds/v1/fission.io_functions.yaml @@ -41,7 +41,7 @@ spec: description: ExecutionStrategy specifies low-level parameters for function execution, such as the number of instances. properties: ExecutorType: - description: "ExecutorType is the executor type of a function used. Defaults to \"poolmgr\". \n Available value: - poolmgr - newdeploy - container" + description: "ExecutorType is the executor type of function used. Defaults to \"poolmgr\". \n Available value: - poolmgr - newdeploy - container" type: string MaxScale: description: This is only for newdeploy to set up maximum replicas of deployment. @@ -57,7 +57,7 @@ spec: type: integer type: object StrategyType: - description: StrategyType is the strategy type of a function. Now it only supports 'execution'. + description: StrategyType is the strategy type of function. Now it only supports 'execution'. type: string type: object concurrency: diff --git a/crds/v1/fission.io_httptriggers.yaml b/crds/v1/fission.io_httptriggers.yaml index 9d8adb9a..3f7d8275 100644 --- a/crds/v1/fission.io_httptriggers.yaml +++ b/crds/v1/fission.io_httptriggers.yaml @@ -33,7 +33,7 @@ spec: description: HTTPTriggerSpec is for router to expose user functions at the given URL path. properties: createingress: - description: If CreateIngress is true, router will create a ingress definition. + description: If CreateIngress is true, router will create an ingress definition. type: boolean functionref: description: FunctionReference is a reference to the target function. @@ -58,12 +58,12 @@ spec: description: 'TODO: remove this field since we have IngressConfig already Deprecated: the original idea of this field is not for setting Ingress. Since we have IngressConfig now, remove Host after couple releases.' type: string ingressconfig: - description: 'TODO: make IngressConfig a independent Fission resource IngressConfig for router to set up Ingress.' + description: 'TODO: make IngressConfig an independent Fission resource IngressConfig for router to set up Ingress.' properties: annotations: additionalProperties: type: string - description: Annotations will be add to metadata when creating Ingress. + description: Annotations will be added to metadata when creating Ingress. nullable: true type: object host: diff --git a/crds/v1/fission.io_packages.yaml b/crds/v1/fission.io_packages.yaml index 727e4a9b..81f11bd7 100644 --- a/crds/v1/fission.io_packages.yaml +++ b/crds/v1/fission.io_packages.yaml @@ -50,7 +50,7 @@ spec: type: string type: object literal: - description: Literal contents of the package. Can be used for encoding packages below TODO (256KB?) size. + description: Literal contents of the package. Can be used for encoding packages below TODO (256 KB?) size. format: byte type: string type: @@ -84,7 +84,7 @@ spec: type: string type: object literal: - description: Literal contents of the package. Can be used for encoding packages below TODO (256KB?) size. + description: Literal contents of the package. Can be used for encoding packages below TODO (256 KB?) size. format: byte type: string type: diff --git a/hack/update-swagger-docs.sh b/hack/update-swagger-docs.sh index 7105a1e6..55b79ca5 100755 --- a/hack/update-swagger-docs.sh +++ b/hack/update-swagger-docs.sh @@ -18,7 +18,7 @@ kube::swagger::gen_types_swagger_doc() { echo "Generating swagger type docs for ${group_version} at ${gv_dir}" - sed 's/YEAR/2017/' hack/boilerplate.txt > "$TMPFILE" + # sed 's/YEAR/2017/' hack/boilerplate.txt > "$TMPFILE" echo "package ${group_version##*/}" >> "$TMPFILE" cat >> "$TMPFILE" < + Fission Custom Resources Definition(CRD) Reference +url: /docs/crd-reference/ +---