Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Adds API documentation to site. Adds verification in CI to ensure up …
Browse files Browse the repository at this point in the history
…to date

Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
  • Loading branch information
JoshVanL committed Sep 26, 2018
1 parent 18b287c commit 744cb37
Show file tree
Hide file tree
Showing 791 changed files with 121,750 additions and 2,775 deletions.
742 changes: 681 additions & 61 deletions Gopkg.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Gopkg.toml
Expand Up @@ -6,6 +6,8 @@ required = [
"k8s.io/code-generator/cmd/defaulter-gen",
"k8s.io/code-generator/cmd/informer-gen",
"k8s.io/code-generator/cmd/lister-gen",
"k8s.io/kube-openapi/cmd/openapi-gen",
"github.com/kubernetes-incubator/reference-docs/gen-apidocs",
"github.com/golang/mock/mockgen",
"github.com/jteeuwen/go-bindata/go-bindata",
]
Expand Down Expand Up @@ -74,6 +76,10 @@ required = [
name = "k8s.io/code-generator"
version = "kubernetes-1.9.3"

[[constraint]]
name = "github.com/kubernetes-incubator/reference-docs"
branch = "kubebuilder"

[[constraint]]
name = "gopkg.in/src-d/go-git.v4"
revision = "b08cc8dc5450981530af3e6f6ad1159ae8ea8705"
Expand Down Expand Up @@ -174,3 +180,6 @@ required = [
name = "k8s.io/code-generator"
non-go = false
unused-packages = false
[[prune.project]]
name = "k8s.io/kube-openapi"
unused-packages = false
36 changes: 34 additions & 2 deletions Makefile
Expand Up @@ -20,18 +20,26 @@ GOPATH ?= /tmp/go

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
TAR_EXT := tar.xz
SHASUM := sha256sum -c
DEP_URL := https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
DEP_HASH := 287b08291e14f1fae8ba44374b26a2b12eb941af3497ed0ca649253e21ba2f83
GORELEASER_URL := https://github.com/goreleaser/goreleaser/releases/download/v0.77.0/goreleaser_Linux_x86_64.tar.gz
GORELEASER_HASH := aae3c5bb76b282e29940f2654b48b13e51f664368c7589d0e86b391b7ef51cc8
NODE_NAME := node-v8.12.0-linux-x64
NODE_URL := https://nodejs.org/dist/v8.12.0/${NODE_NAME}.$(TAR_EXT)
NODE_HASH := 29a20479cd1e3a03396a4e74a1784ccdd1cf2f96928b56f6ffa4c8dae40c88f2
endif
ifeq ($(UNAME_S),Darwin)
TAR_EXT := tar.gz
SHASUM := shasum -a 256 -c
DEP_URL := https://github.com/golang/dep/releases/download/v0.5.0/dep-darwin-amd64
DEP_HASH := 1a7bdb0d6c31ecba8b3fd213a1170adf707657123e89dff234871af9e0498be2
GORELEASER_URL := https://github.com/goreleaser/goreleaser/releases/download/v0.77.0/goreleaser_Darwin_x86_64.tar.gz
GORELEASER_HASH := bc6cdf2dfe506f2cce5abceb30da009bfd5bcdb3e52608c536e6c2ceea1f24fe
NODE_NAME := node-v8.12.0-darwin-x64
NODE_URL := https://nodejs.org/dist/v8.12.0/${NODE_NAME}.$(TAR_EXT)
NODE_HASH := ca131b84dfcf2b6f653a6521d31f7a108ad7d83f4d7e781945b2eca8172064aa
endif


Expand All @@ -46,7 +54,7 @@ help:

test: go_test

verify: generate go_verify verify_boilerplate verify_codegen verify_vendor
verify: generate go_verify verify_boilerplate verify_codegen verify_vendor verify_reference_docs

all: verify test build

Expand Down Expand Up @@ -127,6 +135,16 @@ $(BINDIR)/dep:
echo "$(DEP_HASH) $@" | $(SHASUM)
chmod +x $@

$(BINDIR)/node:
curl -sL -o $(BINDIR)/$(NODE_NAME).$(TAR_EXT) $(NODE_URL)
echo "$(NODE_HASH) $(BINDIR)/$(NODE_NAME).$(TAR_EXT)" | $(SHASUM)
cd $(BINDIR) && tar xf $(NODE_NAME).$(TAR_EXT)
rm $(BINDIR)/$(NODE_NAME).$(TAR_EXT)
ln -s $(BINDIR)/$(NODE_NAME)/bin/node $(BINDIR)/node
ln -s $(BINDIR)/$(NODE_NAME)/bin/npm $(BINDIR)/npm

$(BINDIR)/npm: $(BINDIR)/node

# upx binary packer, only supported on Linux
$(BINDIR)/upx:
ifeq ($(UNAME_S),Linux)
Expand All @@ -146,20 +164,34 @@ $(BINDIR)/goreleaser:
cd $(BINDIR) && tar xzvf $(shell basename $@).tar.gz goreleaser
rm $@.tar.gz

depend: $(BINDIR)/go-bindata $(BINDIR)/mockgen $(BINDIR)/defaulter-gen $(BINDIR)/defaulter-gen $(BINDIR)/deepcopy-gen $(BINDIR)/conversion-gen $(BINDIR)/client-gen $(BINDIR)/lister-gen $(BINDIR)/informer-gen $(BINDIR)/dep $(BINDIR)/goreleaser $(BINDIR)/upx
$(BINDIR)/openapi-gen:
mkdir -p $(BINDIR)
go build -o $@ ./vendor/k8s.io/kube-openapi/cmd/openapi-gen

$(BINDIR)/gen-apidocs:
mkdir -p $(BINDIR)
go build -o $@ ./vendor/github.com/kubernetes-incubator/reference-docs/gen-apidocs

depend: $(BINDIR)/go-bindata $(BINDIR)/mockgen $(BINDIR)/defaulter-gen $(BINDIR)/defaulter-gen $(BINDIR)/deepcopy-gen $(BINDIR)/conversion-gen $(BINDIR)/client-gen $(BINDIR)/lister-gen $(BINDIR)/informer-gen $(BINDIR)/dep $(BINDIR)/goreleaser $(BINDIR)/upx $(BINDIR)/openapi-gen $(BINDIR)/gen-apidocs $(BINDIR)/node

go_generate: depend
go generate $$(go list ./pkg/... ./cmd/...)

go_codegen: depend $(TYPES_FILES)
$(HACK_DIR)/update-codegen.sh

go_reference_docs_gen: depend
$(HACK_DIR)/update-reference-docs.sh

verify_boilerplate:
$(HACK_DIR)/verify-boilerplate.sh

verify_codegen:
$(HACK_DIR)/verify-codegen.sh

verify_reference_docs: $(BINDIR)/node
$(HACK_DIR)/verify-reference-docs.sh

verify_vendor: $(BINDIR)/dep
dep ensure -no-vendor -dry-run -v

Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
@@ -1,3 +1,4 @@
/_build/
/.venv
/venv/
/bin/
3 changes: 3 additions & 0 deletions docs/api-docs.rst
@@ -0,0 +1,3 @@
=================
API documentation
=================
8 changes: 6 additions & 2 deletions docs/conf.py
Expand Up @@ -20,6 +20,7 @@
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import time

# -- General configuration ------------------------------------------------

Expand All @@ -42,14 +43,15 @@
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']
#source_suffix = ['.rst', '.md']
source_suffix = ['.rst']

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Tarmak'
copyright = u'2017, Jetstack'
copyright = u'%s, Jetstack' % time.strftime('%Y')
author = u'Jetstack'

html_logo = "static/logo-tarmak.png"
Expand All @@ -75,6 +77,8 @@
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'venv']

html_extra_path = [u'generated/reference/output']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

Expand Down
18 changes: 18 additions & 0 deletions docs/generated/reference/config.yaml
@@ -0,0 +1,18 @@
example_location: "examples"
api_groups:
- "Tarmak"
- "Wing"
- "Cluster"
resource_categories:
- name: "Tarmak"
include: "tarmak"
resources:
- name: "Config"
version: "v1alpha1"
group: "tarmak"
- name: "Cluster"
version: "v1alpha1"
group: "cluster"
- name: "Instance"
version: "v1alpha1"
group: "wing"
58 changes: 58 additions & 0 deletions docs/generated/reference/output/actions.js
@@ -0,0 +1,58 @@
// https://jsfiddle.net/upqwhou2/

$(document).ready(function() {
var navigationLinks = $('#sidebar-wrapper > ul li a');
var navigationSections = $('#sidebar-wrapper > ul > ul');
var sectionIdTonavigationLink = {};
var sections = $('#page-content-wrapper').find('h1, h2').map(function(index, node) {
if (node.id) {
sectionIdTonavigationLink[node.id] = $('#sidebar-wrapper > ul li a[href="#' + node.id + '"]');
return node;
}
});
var sectionIdToNavContainerLink = {};
var topLevelSections = $('#page-content-wrapper').find('h1').map(function(index, node) {
if (node.id) {
sectionIdToNavContainerLink[node.id] = $('#sidebar-wrapper > ul > ul[id="' + node.id + '-nav' +'"]');
return node;
}
});

var firstLevelNavs = $('#sidebar-wrapper > li');
var secondLevelNavs = $('#sidebar-wrapper > ul > ul');
var secondLevelNavContents = $('#sidebar-wrapper > ul > ul > li');
var thirdLevelNavs = null; // TODO: When compile provides 3 level nav, implement

var sectionsReversed = $(sections.get().reverse());

function checkScroll(event) {
var scrollPosition = $(window).scrollTop();
var offset = 50;
scrollPosition += offset;
sections.each(function() {
var currentSection = $(this);
var sectionTop = $(this).offset().top;
var id = $(this).attr('id');
if (scrollPosition >= sectionTop) {
navigationLinks.removeClass('selected');
sectionIdTonavigationLink[id].addClass('selected');
var sectionNavContainer = sectionIdToNavContainerLink[id];
var sectionNavContainerDisplay;
if (sectionNavContainer) {
sectionNavContainerDisplay = sectionNavContainer.css('display');
}
if (sectionNavContainer && sectionNavContainerDisplay === 'none') {
navigationSections.toggle(false);
sectionNavContainer.toggle(true);
}
}
if (($(this).offset().top < window.pageYOffset + 50) && $(this).offset().top + $(this).height() > window.pageYOffset) {
window.location.hash = id;
}
});
}
checkScroll();
$(window).on('scroll', function(event) {
checkScroll(event);
});
});

0 comments on commit 744cb37

Please sign in to comment.