فهرست منبع

docs,website: add doc for kg

This commit adds a doc for `kg`, the Kilo agent that runs on every node
in the mesh. This includes: the doc itself, files needed for the
website, and tooling to generate the document using `embedmd`.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
Lucas Servén Marín 5 سال پیش
والد
کامیت
0cc1a2ff8c
6فایلهای تغییر یافته به همراه71 افزوده شده و 1 حذف شده
  1. 1 0
      .gitignore
  2. 11 0
      Makefile
  3. 53 0
      docs/kg.md
  4. 1 0
      tools.go
  5. 4 0
      website/docs/kg
  6. 1 1
      website/sidebars.js

+ 1 - 0
.gitignore

@@ -3,3 +3,4 @@
 .manifest*
 .manifest*
 .push*
 .push*
 bin/
 bin/
+tmp/

+ 11 - 0
Makefile

@@ -31,6 +31,7 @@ INFORMER_GEN_BINARY := bin/informer-gen
 LISTER_GEN_BINARY := bin/lister-gen
 LISTER_GEN_BINARY := bin/lister-gen
 OPENAPI_GEN_BINARY := bin/openapi-gen
 OPENAPI_GEN_BINARY := bin/openapi-gen
 GOLINT_BINARY := bin/golint
 GOLINT_BINARY := bin/golint
+EMBEDMD_BINARY := bin/embedmd
 
 
 BUILD_IMAGE ?= golang:1.14.2-alpine
 BUILD_IMAGE ?= golang:1.14.2-alpine
 BASE_IMAGE ?= alpine:3.12
 BASE_IMAGE ?= alpine:3.12
@@ -200,6 +201,13 @@ header: .header
 		exit 1; \
 		exit 1; \
 	fi
 	fi
 
 
+tmp/help.txt: bin/$(ARCH)/kg
+	mkdir -p tmp
+	bin/$(ARCH)/kg --help 2>&1 | head -n -1 > $@
+
+docs/kg.md: $(EMBEDMD_BINARY) tmp/help.txt
+	$(EMBEDMD_BINARY) -w $@
+
 website/docs/README.md: README.md
 website/docs/README.md: README.md
 	rm -rf website/static/img/graphs
 	rm -rf website/static/img/graphs
 	find docs  -type f -name '*.md' | xargs -I{} sh -c 'cat $(@D)/$$(basename {} .md) > website/{}'
 	find docs  -type f -name '*.md' | xargs -I{} sh -c 'cat $(@D)/$$(basename {} .md) > website/{}'
@@ -311,3 +319,6 @@ $(OPENAPI_GEN_BINARY):
 
 
 $(GOLINT_BINARY):
 $(GOLINT_BINARY):
 	go build -mod=vendor -o $@ golang.org/x/lint/golint
 	go build -mod=vendor -o $@ golang.org/x/lint/golint
+
+$(EMBEDMD_BINARY):
+	go build -mod=vendor -o $@ github.com/campoy/embedmd

+ 53 - 0
docs/kg.md

@@ -0,0 +1,53 @@
+# kg
+
+`kg` is the Kilo agent that runs on every Kubernetes node in a Kilo mesh.
+It performs several key functions, including:
+* adding the node to the Kilo mesh;
+* installing CNI configuration on the node;
+* configuring the WireGuard network interface; and
+* maintaining routing table entries and iptables rules.
+
+`kg` is typically installed on all nodes of a Kubernetes cluster using a DaemonSet.
+Example manifests can be found [in the manifests directory](https://github.com/squat/kilo/tree/master/manifests).
+
+## Usage
+
+The behavior of `kg` can be configured using the command line flags listed below.
+
+[embedmd]:# (../tmp/help.txt)
+```txt
+Usage of bin/amd64/kg:
+  -backend string
+    	The backend for the mesh. Possible values: kubernetes (default "kubernetes")
+  -clean-up-interface
+    	Should Kilo delete its interface when it shuts down?
+  -cni
+    	Should Kilo manage the node's CNI configuration? (default true)
+  -cni-path string
+    	Path to CNI config. (default "/etc/cni/net.d/10-kilo.conflist")
+  -compatibility string
+    	Should Kilo run in compatibility mode? Possible values: flannel
+  -encapsulate string
+    	When should Kilo encapsulate packets within a location? Possible values: never, crosssubnet, always (default "always")
+  -hostname string
+    	Hostname of the node on which this process is running.
+  -interface string
+    	Name of the Kilo interface to use; if it does not exist, it will be created. (default "kilo0")
+  -kubeconfig string
+    	Path to kubeconfig.
+  -listen string
+    	The address at which to listen for health and metrics. (default ":1107")
+  -local
+    	Should Kilo manage routes within a location? (default true)
+  -log-level string
+    	Log level to use. Possible values: all, debug, info, warn, error, none (default "info")
+  -master string
+    	The address of the Kubernetes API server (overrides any value in kubeconfig).
+  -mesh-granularity string
+    	The granularity of the network mesh to create. Possible values: location, full (default "location")
+  -port uint
+    	The port over which WireGuard peers should communicate. (default 51820)
+  -subnet string
+    	CIDR from which to allocate addresses for WireGuard interfaces. (default "10.4.0.0/16")
+  -version
+```

+ 1 - 0
tools.go

@@ -17,6 +17,7 @@
 package main
 package main
 
 
 import (
 import (
+	_ "github.com/campoy/embedmd"
 	_ "golang.org/x/lint/golint"
 	_ "golang.org/x/lint/golint"
 	_ "k8s.io/code-generator/cmd/client-gen"
 	_ "k8s.io/code-generator/cmd/client-gen"
 	_ "k8s.io/code-generator/cmd/deepcopy-gen"
 	_ "k8s.io/code-generator/cmd/deepcopy-gen"

+ 4 - 0
website/docs/kg

@@ -0,0 +1,4 @@
+---
+id: kg
+hide_title: true
+---

+ 1 - 1
website/sidebars.js

@@ -12,7 +12,7 @@ module.exports = {
     {
     {
       type: 'category',
       type: 'category',
       label: 'Reference',
       label: 'Reference',
-      items: ['annotations', 'kgctl'],
+      items: ['annotations', 'kg', 'kgctl'],
     },
     },
     //Features: ['mdx'],
     //Features: ['mdx'],
   ],
   ],