-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Allows doc writing in markdown 2. Automatically generate txt docs and builds it into binary 3. paging support for viewing docs using short man command 4. Update .gitignore ot ignore generated files
- Loading branch information
Showing
15 changed files
with
778 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/bin | ||
|
||
generated/*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.8 | ||
|
||
RUN cat /etc/os-release | ||
|
||
RUN apt-get update | ||
|
||
RUN wget http://http.us.debian.org/debian/pool/non-free/x/xml2rfc/xml2rfc_2.4.8-1_all.deb | ||
|
||
#Install binaries from debian needed for golang, python, xml2rfc, and mmark | ||
RUN apt-get -y install python python-lxml | ||
|
||
RUN dpkg -i xml2rfc_2.4.8-1_all.deb | ||
RUN apt-get install -f | ||
|
||
RUN go get github.com/BurntSushi/toml | ||
RUN go get github.com/miekg/mmark/... | ||
RUN go get -u github.com/jteeuwen/go-bindata/... | ||
|
||
RUN mkdir -p /go/src/github.com/koki/short | ||
WORKDIR /go/src/github.com/koki/short | ||
COPY .* /go/src/github.com/koki/short/ | ||
|
||
ENTRYPOINT ["scripts/ci.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"index/suffixarray" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/koki/short/generated" | ||
"github.com/koki/short/pager" | ||
"github.com/koki/short/util" | ||
) | ||
|
||
var ( | ||
manCommand = &cobra.Command{ | ||
Use: "man", | ||
Short: "Reference and Examples for resources and conversions", | ||
Long: "Reference and Examples for koki <-> kubernetes conversions", | ||
RunE: man, | ||
Args: cobra.ExactArgs(1), | ||
SilenceUsage: true, | ||
} | ||
) | ||
|
||
func man(c *cobra.Command, args []string) error { | ||
resourceName := args[0] | ||
resourcePath := "../generated/" + resourceName + ".txt" | ||
data, err := generated.Asset(resourcePath) | ||
if err != nil { | ||
return util.UsageErrorf(c.CommandPath, "Unsupported resource name %s", resourceName) | ||
} | ||
|
||
index := suffixarray.New(data) | ||
|
||
buf := bytes.NewBuffer(data) | ||
p := pager.NewPager(buf, index) | ||
return p.Render() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
%%% | ||
title = "Pod Conversion Conventions" | ||
abbrev = "Pod" | ||
category = "info" | ||
area = "Koki Short" | ||
keyword = ["Pod"] | ||
|
||
[[author]] | ||
fullname = "Caascade Labs, Inc." | ||
%%% | ||
|
||
.# Abstract | ||
|
||
This document provides the details of the conversion mechanisms between Kubernetes Pod syntax and Koki Short syntax | ||
|
||
{mainmatter} | ||
|
||
# Introduction {#introduction} | ||
|
||
A Pod is the unit of execution when using the Kubernetes orchestrator. It is defined in the api group core/v1. This version of Koki Short supports all valid Pod definitions of Kubernetes Versions \[v1.0 - v1.8] | ||
|
||
A> No data is lost when converting between koki and kubernetes types | ||
|
||
# Conversion from Kubernetes to Koki | ||
|
||
The Kubernetes API Object for Pod has a kind Key that always refers to value "Pod". This information is redundant, since Kubernetes parsers identify the type, and provide us with the Pod object, therefore this Kind field is removed in Koki and instead a new top level key called pod is used to denote a pod. | ||
|
||
A kubernetes pod definitions looks like | ||
|
||
~~~ | ||
apiVersion: v1 | ||
kind: pod | ||
metadata: | ||
name: pod_name | ||
... | ||
~~~ | ||
|
||
A koki pod definition written using Short syntax would look like | ||
|
||
~~~ | ||
pod: | ||
name: pod_name | ||
... | ||
~~~ | ||
|
||
As you can see, without getting into the most reductive parts, pod definitions in koki short syntax already look cleaner. | ||
|
||
# Conversion from Koki to Kubernetes | ||
|
||
|
||
|
||
# Examples | ||
|
||
{backmatter} |
Oops, something went wrong.