regenerate ref docs, 1.17, script chgs (#18067)

* modify comp. tool reference config

* modify home dir to variable

* added k8s_release variable

* added kubectl cmd build

added temporary use of copied Makefile

* added build of api ref

* build api, kubectl cmd refs

* regenerate api with updated bootstrap

* regenerate api ref, corrected definitions
This commit is contained in:
Karen Bradshaw
2020-01-03 12:39:40 -05:00
committed by Kubernetes Prow Robot
parent e28015e910
commit bcfbd1e8f3
35 changed files with 2316 additions and 431 deletions
+100
View File
@@ -0,0 +1,100 @@
WEBROOT=${K8S_WEBROOT}
K8SROOT=${K8S_ROOT}
MINOR_VERSION=${K8S_RELEASE}
APISRC=gen-apidocs/generators
APIDST=$(WEBROOT)/static/docs/reference/generated/kubernetes-api/v1.$(MINOR_VERSION)
APISRCFONT=$(APISRC)/build/node_modules/font-awesome
APIDSTFONT=$(APIDST)/node_modules/font-awesome
CLISRC=gen-kubectldocs/generators/build
CLIDST=$(WEBROOT)/static/docs/reference/generated/kubectl
CLISRCFONT=$(CLISRC)/node_modules/font-awesome
CLIDSTFONT=$(CLIDST)/node_modules/font-awesome
default:
@echo "Support commands:\ncli api comp copycli copyapi copycomp updateapispec"
# Build kubectl docs
cleancli:
sudo rm -f main
sudo rm -rf $(shell pwd)/gen-kubectldocs/generators/includes
sudo rm -rf $(shell pwd)/gen-kubectldocs/generators/build
sudo rm -rf $(shell pwd)/gen-kubectldocs/generators/manifest.json
cli: cleancli
mkdir -p $(shell pwd)/gen-kubectldocs/generators/v1_$(MINOR_VERSION)
cp -r $(shell pwd)/gen-kubectldocs/generators/v1_15/* $(shell pwd)/gen-kubectldocs/generators/v1_$(MINOR_VERSION)
go run gen-kubectldocs/main.go --kubernetes-version v1_$(MINOR_VERSION)
docker run -v $(shell pwd)/gen-kubectldocs/generators/includes:/source -v $(shell pwd)/gen-kubectldocs/generators/build:/build -v $(shell pwd)/gen-kubectldocs/generators/:/manifest pwittrock/brodocs
copycli: cli
cp gen-kubectldocs/generators/build/index.html $(WEBROOT)/static/docs/reference/generated/kubectl/kubectl-commands.html
cp gen-kubectldocs/generators/build/navData.js $(WEBROOT)/static/docs/reference/generated/kubectl/navData.js
cp $(CLISRC)/scroll.js $(CLIDST)/scroll.js
cp $(CLISRC)/stylesheet.css $(CLIDST)/stylesheet.css
cp $(CLISRC)/tabvisibility.js $(CLIDST)/tabvisibility.js
cp $(CLISRC)/node_modules/bootstrap/dist/css/bootstrap.min.css $(CLIDST)/node_modules/bootstrap/dist/css/bootstrap.min.css
cp $(CLISRC)/node_modules/highlight.js/styles/default.css $(CLIDST)/node_modules/highlight.js/styles/default.css
cp $(CLISRC)/node_modules/jquery.scrollto/jquery.scrollTo.min.js $(CLIDST)/node_modules/jquery.scrollto/jquery.scrollTo.min.js
cp $(CLISRC)/node_modules/jquery/dist/jquery.min.js $(CLIDST)/node_modules/jquery/dist/jquery.min.js
cp $(CLISRCFONT)/css/font-awesome.min.css $(CLIDSTFONT)/css/font-awesome.min.css
# Build kube component docs
cleancomp:
rm -rf $(shell pwd)/gen-compdocs/build
comp: cleancomp
mkdir -p gen-compdocs/build
go run gen-compdocs/main.go gen-compdocs/build kube-apiserver
go run gen-compdocs/main.go gen-compdocs/build kube-controller-manager
go run gen-compdocs/main.go gen-compdocs/build cloud-controller-manager
go run gen-compdocs/main.go gen-compdocs/build kube-scheduler
go run gen-compdocs/main.go gen-compdocs/build kubelet
go run gen-compdocs/main.go gen-compdocs/build kube-proxy
go run gen-compdocs/main.go gen-compdocs/build kubeadm
go run gen-compdocs/main.go gen-compdocs/build kubectl
copycomp:
cp $(shell pwd)/gen-compdocs/build/* $(WEBROOT)/docs/reference/generated/
# Build api docs
updateapispec:
cp $(K8SROOT)/api/openapi-spec/swagger.json gen-apidocs/generators/openapi-spec/swagger.json
api: cleanapi
go run gen-apidocs/main.go --config-dir=gen-apidocs/generators --munge-groups=false
# NOTE: The following "sudo" may go away when we remove docker based api doc generator
cleanapi:
sudo rm -rf $(shell pwd)/gen-apidocs/generators/build
sudo rm -rf $(shell pwd)/gen-apidocs/generators/includes
copyapi:
cp $(APISRC)/build/index.html $(APIDST)/index.html
cp $(APISRC)/build/navData.js $(APIDST)/navData.js
cp $(APISRC)/static/scroll.js $(APIDST)/scroll.js
mkdir -p $(APIDST)/css
cp $(APISRC)/static/stylesheet.css $(APIDST)/css/stylesheet.css
cp $(APISRC)/static/bootstrap.min.css $(APIDST)/css/bootstrap.min.css
cp $(APISRC)/static/jquery.scrollTo.min.js $(APIDST)/jquery.scrollTo.min.js
cp $(APISRC)/static/font-awesome.min.css $(APIDST)/css/font-awesome.min.css
mkdir -p $(APIDST)/fonts
cp $(APISRC)/static/FontAwesome.otf $(APIDST)/fonts/FontAwesome.otf
cp $(APISRC)/static/fontawesome-webfont.eot $(APIDST)/fonts/fontawesome-webfont.eot
cp $(APISRC)/static/fontawesome-webfont.svg $(APIDST)/fonts/fontawesome-webfont.svg
cp $(APISRC)/static/fontawesome-webfont.ttf $(APIDST)/fonts/fontawesome-webfont.ttf
cp $(APISRC)/static/fontawesome-webfont.woff $(APIDST)/fonts/fontawesome-webfont.woff
cp $(APISRC)/static/fontawesome-webfont.woff2 $(APIDST)/fonts/fontawesome-webfont.woff2
# Build resource docs
resource: cleanapi
go run gen-apidocs/main.go --build-operations=false --munge-groups=false --config-dir=gen-apidocs/generators
docker run -v $(shell pwd)/gen-apidocs/generators/includes:/source -v $(shell pwd)/gen-apidocs/generators/build:/build -v $(shell pwd)/gen-apidocs/generators/:/manifest pwittrock/brodocs
copyresource: resource
rm -rf gen-apidocs/generators/build/documents/
rm -rf gen-apidocs/generators/build/runbrodocs.sh
rm -rf gen-apidocs/generators/build/manifest.json
rm -rf $(WEBROOT)/docs/resources-reference/v1.$(MINOR_VERSION)/*
cp -r gen-apidocs/generators/build/* $(WEBROOT)/docs/resources-reference/v1.$(MINOR_VERSION)/
+22 -2
View File
@@ -8,14 +8,34 @@ repos:
cd $GOPATH
git clone https://github.com/kubernetes/kubernetes.git src/k8s.io/kubernetes
cd src/k8s.io/kubernetes
git checkout release-1.16
git checkout release-1.${K8S_RELEASE}
make generated_files
cp -L -R vendor $GOPATH/src
rm -r vendor
rm -r vendor/github.com/spf13/cobra
rm -r vendor/github.com/spf13/pflag
cd $GOPATH
go get -v github.com/kubernetes-sigs/reference-docs/gen-compdocs
cd src/github.com/kubernetes-sigs/reference-docs/
# generate component tool pages
make comp
cd $GOPATH
go get -v github.com/kubernetes-sigs/reference-docs/gen-kubectldocs
cd src/github.com/kubernetes-sigs/reference-docs/
cp ${K8S_WEBROOT}/update-imported-docs/Makefile_temp ./Makefile
# generate kubectl cmd reference
make copycli
#
# generate api reference
cd $GOPATH
rm -rf src/vendor
go get -u github.com/go-openapi/loads
go get -u github.com/go-openapi/spec
go get -v github.com/kubernetes-sigs/reference-docs/gen-apidocs
cd src/github.com/kubernetes-sigs/reference-docs/
make updateapispec
make api
make copyapi
files:
- src: gen-compdocs/build/cloud-controller-manager.md
+20 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
##
# This script was tested with Python 3.7.4, Go 1.12, and PyYAML 5.1.2
# This script was tested with Python 3.7.4, Go 1.13+, and PyYAML 5.1.2
# installed in a virtual environment.
# This script assumes you have the Python package manager 'pip' installed.
#
@@ -18,10 +18,11 @@
# This work_dir will temporarily become the GOPATH.
#
# To execute the script from the website/update-imported-docs directory:
# ./update-imported-docs.py <config_file>
# ./update-imported-docs.py <config_file> <k8s_release>
# Config files:
# reference.yml use this to update the reference docs
# release.yml use this to auto-generate/import release notes
# K8S_RELEASE: provide the minor release version such as, 17
##
import argparse
@@ -154,14 +155,19 @@ def process_file(src, dst, repo_path, repo_dir, root_dir, gen_absolute_links):
def parse_input_args():
"""
Parse command line argument
'config_file' is only one argument; it should be one of the YAML
'config_file' is the first argument; it should be one of the YAML
files in this same directory
'k8s_release' is the second argument; provide the release minor
version
:return: parsed argument
"""
parser = argparse.ArgumentParser()
parser.add_argument('config_file', type=str,
help="reference.yml to generate reference docs; "
"release.yml to generate release notes")
parser.add_argument('k8s_release', type=str,
help="k8s release minor version, ex: 17"
)
return parser.parse_args()
@@ -177,6 +183,10 @@ def main():
config_file = in_args.config_file
print("config_file is {}".format(config_file))
# second parse input argument
k8s_release = in_args.k8s_release
print("ks8_release is {}".format(k8s_release))
curr_dir = os.path.dirname(__file__)
print("curr_dir {}".format(curr_dir))
root_dir = os.path.realpath(os.path.join(curr_dir, '..'))
@@ -200,6 +210,8 @@ def main():
.format(work_dir, ose))
return -2
print("Working dir {}".format(work_dir))
for repo in config_data["repos"]:
if "name" not in repo:
print("[Error] repo missing name")
@@ -231,7 +243,11 @@ def main():
os.chdir(repo_path)
if "generate-command" in repo:
gen_cmd = repo["generate-command"]
gen_cmd = "export GOPATH=" + work_dir + "\n" + gen_cmd
gen_cmd = "export K8S_RELEASE=" + k8s_release + "\n" + \
"export GOPATH=" + work_dir + "\n" + \
"export K8S_ROOT=" + work_dir + \
"/src/k8s.io/kubernetes" + "\n" + \
"export K8S_WEBROOT=" + root_dir + "\n" + gen_cmd
print("Generating docs for {} with {}".format(repo_name, gen_cmd))
res = subprocess.call(gen_cmd, shell=True)
if res != 0: