-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3112 from martinhoefling/profile-composability-docs
document activation of multiple profiles
- Loading branch information
Showing
23 changed files
with
299 additions
and
0 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
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 @@ | ||
=== Example: Getting started with a simple go app | ||
:icons: font | ||
|
||
This is a simple show-case of how Skaffold profiles can be patched. | ||
Patched profiles e.g. can be used in development to provide a composable development setup. | ||
Here, a "base" service is always started. Two additional services "hello" and "world" can be activated via profiles. | ||
|
||
==== Init | ||
Use the `--profile` option to add profiles `skaffold dev --profile hello,world` | ||
|
||
==== Workflow | ||
* Build only the `base-service` when using the main profile | ||
* Build `hello` and/or `world` when specified via `-p` flag. Multiple `-p` flags are supported as well as comma separated values. | ||
|
||
ifndef::env-github[] | ||
==== link:{github-repo-tree}/examples/profiles[Example files icon:github[]] | ||
|
||
[source,yaml, indent=3, title=skaffold.yaml] | ||
---- | ||
include::skaffold.yaml[] | ||
---- | ||
|
||
endif::[] |
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: base-service | ||
spec: | ||
containers: | ||
- name: base-service | ||
image: gcr.io/k8s-skaffold/skaffold-base |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("BASE") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: hello-service | ||
spec: | ||
containers: | ||
- name: hello-service | ||
image: gcr.io/k8s-skaffold/skaffold-hello |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("HELLO") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |
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,34 @@ | ||
apiVersion: skaffold/v1beta16 | ||
kind: Config | ||
build: | ||
# only build and deploy "base-service" on main profile | ||
artifacts: | ||
- image: gcr.io/k8s-skaffold/skaffold-base | ||
context: base-service | ||
deploy: | ||
kubectl: | ||
manifests: | ||
- 'base-service/*.yaml' | ||
|
||
profiles: | ||
- name: hello | ||
patches: | ||
- op: add | ||
path: /build/artifacts/1 | ||
value: | ||
image: gcr.io/k8s-skaffold/skaffold-hello | ||
context: hello-service | ||
- op: add | ||
path: /deploy/kubectl/manifests/1 | ||
value: 'hello-service/*.yaml' | ||
|
||
- name: world | ||
patches: | ||
- op: add | ||
path: /build/artifacts/1 | ||
value: | ||
image: gcr.io/k8s-skaffold/skaffold-world | ||
context: world-service | ||
- op: add | ||
path: /deploy/kubectl/manifests/1 | ||
value: 'world-service/*.yaml' |
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: world-service | ||
spec: | ||
containers: | ||
- name: world-service | ||
image: gcr.io/k8s-skaffold/skaffold-world |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("WORLD") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |
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 @@ | ||
=== Example: Getting started with a simple go app | ||
:icons: font | ||
|
||
This is a simple show-case of how Skaffold profiles can be patched. | ||
Patched profiles e.g. can be used in development to provide a composable development setup. | ||
Here, a "base" service is always started. Two additional services "hello" and "world" can be activated via profiles. | ||
|
||
==== Init | ||
Use the `--profile` option to add profiles `skaffold dev --profile hello,world` | ||
|
||
==== Workflow | ||
* Build only the `base-service` when using the main profile | ||
* Build `hello` and/or `world` when specified via `-p` flag. Multiple `-p` flags are supported as well as comma separated values. | ||
|
||
ifndef::env-github[] | ||
==== link:{github-repo-tree}/examples/profiles[Example files icon:github[]] | ||
|
||
[source,yaml, indent=3, title=skaffold.yaml] | ||
---- | ||
include::skaffold.yaml[] | ||
---- | ||
|
||
endif::[] |
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
8 changes: 8 additions & 0 deletions
8
integration/examples/profile-patches/base-service/k8s-pod.yaml
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: base-service | ||
spec: | ||
containers: | ||
- name: base-service | ||
image: gcr.io/k8s-skaffold/skaffold-base |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("BASE") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
integration/examples/profile-patches/hello-service/Dockerfile
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
8 changes: 8 additions & 0 deletions
8
integration/examples/profile-patches/hello-service/k8s-pod.yaml
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: hello-service | ||
spec: | ||
containers: | ||
- name: hello-service | ||
image: gcr.io/k8s-skaffold/skaffold-hello |
14 changes: 14 additions & 0 deletions
14
integration/examples/profile-patches/hello-service/main.go
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("HELLO") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |
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,34 @@ | ||
apiVersion: skaffold/v1beta16 | ||
kind: Config | ||
build: | ||
# only build and deploy "base-service" on main profile | ||
artifacts: | ||
- image: gcr.io/k8s-skaffold/skaffold-base | ||
context: base-service | ||
deploy: | ||
kubectl: | ||
manifests: | ||
- 'base-service/*.yaml' | ||
|
||
profiles: | ||
- name: hello | ||
patches: | ||
- op: add | ||
path: /build/artifacts/1 | ||
value: | ||
image: gcr.io/k8s-skaffold/skaffold-hello | ||
context: hello-service | ||
- op: add | ||
path: /deploy/kubectl/manifests/1 | ||
value: 'hello-service/*.yaml' | ||
|
||
- name: world | ||
patches: | ||
- op: add | ||
path: /build/artifacts/1 | ||
value: | ||
image: gcr.io/k8s-skaffold/skaffold-world | ||
context: world-service | ||
- op: add | ||
path: /deploy/kubectl/manifests/1 | ||
value: 'world-service/*.yaml' |
7 changes: 7 additions & 0 deletions
7
integration/examples/profile-patches/world-service/Dockerfile
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,7 @@ | ||
FROM golang:1.12.9-alpine3.10 as builder | ||
COPY main.go . | ||
RUN go build -o /app main.go | ||
|
||
FROM alpine:3.10 | ||
CMD ["./app"] | ||
COPY --from=builder /app . |
8 changes: 8 additions & 0 deletions
8
integration/examples/profile-patches/world-service/k8s-pod.yaml
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,8 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: world-service | ||
spec: | ||
containers: | ||
- name: world-service | ||
image: gcr.io/k8s-skaffold/skaffold-world |
14 changes: 14 additions & 0 deletions
14
integration/examples/profile-patches/world-service/main.go
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
for { | ||
fmt.Println("WORLD") | ||
|
||
time.Sleep(time.Second * 1) | ||
} | ||
} |