Skip to content

Commit 8311fac

Browse files
committed
Moving to asciidoc based tooling + refdoc generation
1 parent 61d9270 commit 8311fac

28 files changed

+1097
-321
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
out/
22
examples/bazel/bazel-*
33
*.new
4-
.idea/
4+
.idea/
5+
docs/generated
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

2-
# How to Contribute
2+
= How to Contribute
33
We'd love to accept your patches and contributions to this project. There are
44
just a few small guidelines you need to follow.
5-
## Contributor License Agreement
5+
6+
== Contributor License Agreement
7+
68
Contributions to this project must be accompanied by a Contributor License
79
Agreement. You (or your employer) retain the copyright to your contribution,
810
this simply gives us permission to use and redistribute your contributions as
@@ -11,8 +13,17 @@ your current agreements on file or to sign a new one.
1113
You generally only need to submit a CLA once, so if you've already submitted one
1214
(even if it was for a different project), you probably don't need to do it
1315
again.
14-
## Code reviews
16+
17+
== Code reviews
1518
All submissions, including submissions by project members, require review. We
1619
use GitHub pull requests for this purpose. Consult
1720
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
18-
information on using pull requests.
21+
information on using pull requests.
22+
23+
== Contributing to documentation
24+
Contributing to docs is the same process as the code reviews - except that we recommend that you locally you can check the generated docs with
25+
```
26+
make docs
27+
```
28+
And then open the generated docs/generated folder for `index.html` and `index.pdf`.
29+

Makefile

+24-1
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ SUPPORTED_PLATFORMS := linux-$(GOARCH) darwin-$(GOARCH) windows-$(GOARCH).exe
3636
BUILD_PACKAGE = $(REPOPATH)/cmd/skaffold
3737

3838
VERSION_PACKAGE = $(REPOPATH)/pkg/skaffold/version
39+
COMMIT = $(shell git rev-parse HEAD)
3940

4041
GO_LDFLAGS :="
4142
GO_LDFLAGS += -X $(VERSION_PACKAGE).version=$(VERSION)
4243
GO_LDFLAGS += -X $(VERSION_PACKAGE).buildDate=$(shell date +'%Y-%m-%dT%H:%M:%SZ')
43-
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitCommit=$(shell git rev-parse HEAD)
44+
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitCommit=$(COMMIT)
4445
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitTreeState=$(if $(shell git status --porcelain),dirty,clean)
4546
GO_LDFLAGS +="
4647

@@ -103,3 +104,25 @@ integration-in-docker:
103104
-e GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS) \
104105
gcr.io/$(GCP_PROJECT)/skaffold-integration
105106

107+
.PHONY: docs
108+
docs:
109+
rm -rf docs/generated
110+
mkdir -p docs/generated
111+
cp -R docs/css docs/generated/
112+
docker run -v $(PWD):/documents/ asciidoctor/docker-asciidoctor \
113+
asciidoctor \
114+
-a version="$(VERSION)" \
115+
-a commit="$(COMMIT)" \
116+
-a data-uri \
117+
-d book \
118+
-D docs/generated/ \
119+
docs/index.adoc
120+
docker run -v $(PWD):/documents/ asciidoctor/docker-asciidoctor \
121+
asciidoctor-pdf \
122+
-a version="$(VERSION)" \
123+
-a commit="$(COMMIT)" \
124+
-a allow-uri-read \
125+
-d book \
126+
-a pdf \
127+
-D docs/generated/ \
128+
docs/index.adoc

README.adoc

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
= Skaffold
2+
//tag::title[]
3+
:toc: macro
4+
ifndef::imagesdir[]
5+
:imagesdir: docs/img
6+
endif::[]
7+
//end::title[]
8+
9+
[caption="Build status", link="https://travis-ci.org/GoogleContainerTools/skaffold"]
10+
image::https://travis-ci.org/GoogleContainerTools/skaffold.svg?branch=master[Build Status]
11+
12+
//tag::intro[]
13+
Skaffold is a command line tool that facilitates continuous development for Kubernetes applications.
14+
You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters.
15+
Skaffold handles the workflow for building, pushing and deploying your application.
16+
It can also be used in an automated context such as a CI/CD pipeline to leverage the same workflow and tooling when moving applications to production.
17+
//end::intro[]
18+
19+
toc::[]
20+
21+
//tag::features[]
22+
23+
== Features
24+
25+
- No server-side component. No overhead to your cluster.
26+
- Detect changes in your source code and automatically build/push/deploy.
27+
- Image tag management. Stop worrying about updating the image tags in Kubernetes manifests to push out changes during development.
28+
- Supports existing tooling and workflows. Build and deploy APIs make each implementation composable to support many different workflows.
29+
- Support for multiple application components. Build and deploy only the pieces of your stack that have changed.
30+
- Deploy regularly when saving files or run one off deployments using the same configuration.
31+
//end::features[]
32+
33+
//tag::pluggability[]
34+
35+
== Pluggability
36+
Skaffold has a pluggable architecture that allows you to choose the tools in the developer workflow that work best for you.
37+
38+
image::plugability.png[]
39+
//end::pluggability[]
40+
41+
//tag::operatingmodes[]
42+
43+
= Operating modes
44+
== skaffold dev
45+
Updates your deployed application continually:
46+
47+
- Watches your source code and the dependencies of your docker images for changes and runs a build and deploy when changes are detected
48+
- Streams logs from deployed containers
49+
- Continuous build-deploy loop, only warn on errors
50+
51+
== skaffold run
52+
Runs a Skaffold pipeline once, exits on any errors in the pipeline.
53+
Use for:
54+
55+
- Continuous integration or continuous deployment pipelines
56+
- Sanity checking after iterating on your application
57+
//end::operatingmodes[]
58+
59+
//tag::demo[]
60+
= Demo
61+
62+
image::intro.gif[Demo]
63+
//end::demo[]
64+
//tag::getting_started_local[]
65+
66+
= Getting Started with Local Tooling
67+
68+
For getting started with Google Kubernetes Engine and Container Builder link:docs/quickstart-gke.adoc[go here.
69+
Otherwise continue
70+
below to get started with a local Kubernetes cluster.
71+
72+
== Installation
73+
74+
You will need the following components to get started with Skaffold:
75+
76+
. skaffold
77+
- To download the latest Linux build, run:
78+
- `curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin`
79+
- To download the latest OSX build, run:
80+
- `curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-darwin-amd64 && chmod +x skaffold && sudo mv skaffold /usr/local/bin`
81+
82+
. Kubernetes Cluster
83+
- link:https://kubernetes.io/docs/tasks/tools/install-minikube/[Minikube],
84+
link:https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-container-cluster[GKE],
85+
link:https://docs.docker.com/docker-for-windows/install/[Docker for Mac (Edge)] and link:https://docs.docker.com/docker-for-mac/install/[Docker for Windows (Edge)]
86+
have been tested but any Kubernetes cluster will work.
87+
88+
. link:https://kubernetes.io/docs/tasks/tools/install-kubectl/[kubectl]
89+
- If you're not using Minikube, configure the current-context with your target cluster for development
90+
91+
. docker
92+
93+
. Docker image registry
94+
- Your docker client should be configured to push to an external docker image repositor.
95+
If you're using a minikube or Docker for Desktop cluster, you can skip this requirement.
96+
- If you are using Google Container Registry (GCR), choose one of the following:
97+
. Use `gcloud`'s Docker credential helper: Run link:https://cloud.google.com/sdk/gcloud/reference/auth/configure-docker[`gcloud auth configure-docker`]
98+
. Install and configure GCR's standalone cred helper: link:https://github.com/GoogleCloudPlatform/docker-credential-gcr#installation-and-usage[`docker-credential-gcr`]
99+
. Run `gcloud docker -a` before each development session.
100+
101+
== Iterative Development
102+
103+
. Clone this repository to get access to the examples.
104+
[source,shell]
105+
git clone https://github.com/GoogleContainerTools/skaffold
106+
107+
. Change directories to the `getting-started` example.
108+
[source,shell]
109+
cd examples/getting-started
110+
111+
. Run `skaffold dev`.
112+
113+
[source,console]
114+
$ skaffold dev
115+
Starting build...
116+
Found [minikube] context, using local docker daemon.
117+
Sending build context to Docker daemon 6.144kB
118+
Step 1/5 : FROM golang:1.9.4-alpine3.7
119+
---> fb6e10bf973b
120+
Step 2/5 : WORKDIR /go/src/github.com/GoogleContainerTools/skaffold/examples/getting-started
121+
---> Using cache
122+
---> e9d19a54595b
123+
Step 3/5 : CMD ./app
124+
---> Using cache
125+
---> 154b6512c4d9
126+
Step 4/5 : COPY main.go .
127+
---> Using cache
128+
---> e097086e73a7
129+
Step 5/5 : RUN go build -o app main.go
130+
---> Using cache
131+
---> 9c4622e8f0e7
132+
Successfully built 9c4622e8f0e7
133+
Successfully tagged 930080f0965230e824a79b9e7eccffbd:latest
134+
Successfully tagged gcr.io/k8s-skaffold/skaffold-example:9c4622e8f0e7b5549a61a503bf73366a9cf7f7512aa8e9d64f3327a3c7fded1b
135+
Build complete in 657.426821ms
136+
Starting deploy...
137+
Deploying k8s-pod.yaml...
138+
Deploy complete in 173.770268ms
139+
[getting-started] Hello world!
140+
141+
. Skaffold has done the following for you:
142+
143+
- Build an image from the local source code
144+
- Tag it with its sha256
145+
- Sets that image in the Kubernetes manifests defined in `skaffold.yaml`
146+
- Deploy the Kubernetes manifests using `kubectl apply -f`
147+
148+
. You will see the output of the pod that was deployed:
149+
[source,console]
150+
[getting-started] Hello world!
151+
[getting-started] Hello world!
152+
[getting-started] Hello world!
153+
154+
Now, update `main.go`
155+
156+
[source,diff]
157+
-----
158+
diff --git a/examples/getting-started/main.go b/examples/getting-started/main.go
159+
index 64b7bdfc..f95e053d 100644
160+
--- a/examples/getting-started/main.go
161+
+++ b/examples/getting-started/main.go
162+
@@ -7,7 +7,7 @@ import (
163+
164+
func main() {
165+
for {
166+
- fmt.Println("Hello world!")
167+
+ fmt.Println("Hello jerry!")
168+
time.Sleep(time.Second * 1)
169+
}
170+
}
171+
-----
172+
173+
Once you save the file, you should see the pipeline kick off again to redeploy your application:
174+
[source,console]
175+
[getting-started] Hello jerry!
176+
[getting-started] Hello jerry!
177+
178+
== Run a deployment pipeline once
179+
There may be some cases where you don't want to run build and deploy continuously.
180+
To run once, use:
181+
[source,console]
182+
-----
183+
$ skaffold run
184+
-----
185+
186+
//end::getting_started_local[]
187+
188+
//tag::more_examples[]
189+
= More examples
190+
191+
* link:./examples/helm-deployment[Deploying with Helm]
192+
* link:./examples/microservices[Microservices/Multiple applications]
193+
* link:./examples/annotated-skaffold.yaml[Annotated skaffold.yaml]
194+
//end::more_examples[]
195+
196+
197+
//tag::community[]
198+
= Community
199+
- link:https://groups.google.com/forum/#!forum/skaffold-users[skaffold-users mailing list]
200+
- link:https://kubernetes.slack.com/messages/CABQMSZA6/[#skaffold on Kubernetes Slack]
201+
//end::community[]
202+
203+

0 commit comments

Comments
 (0)