Merge pull request #1024 from kubernetes-sigs/change-language-in-remote-demo

Update remoteBuild.md
This commit is contained in:
Jeff Regan
2019-04-29 10:12:39 -07:00
committed by GitHub

View File

@@ -1,33 +1,38 @@
# remote targets # remote targets
`kustomize build` can be run against a url. The effect is the same as cloing the repo, checking out the specified ref, `kustomize build` can be run on a URL.
then running `kustomize build` against the desired directory in the local copy.
Take `github.com/kubernetes-sigs/kustomize//examples/multibases?ref=v1.0.6` as an example. The effect is the same as cloning the repo, checking out a particular
According to [multibases](multibases/README.md) demo, this kustomization contains three Pod objects with names as _ref_ (commit hash, branch name, release tag, etc.),
`cluster-a-dev-myapp-pod`, `cluster-a-stag-myapp-pod`, `cluster-a-prod-myapp-pod`. then running `kustomize build` against the desired
Running `kustomize build` against the url gives the same output. directory in the local copy.
To try this immediately, run a build against the kustomization
in the [multibases](multibases/README.md) example. There's
one pod in the output:
<!-- @remoteOverlayBuild @test -->
```
target="github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6"
test 1 == \
$(kustomize build $target | grep dev-myapp-pod | wc -l); \
echo $?
```
Run against the overlay in that example to get three pods
(the overlay combines the dev, staging and prod bases for
someone who wants to send them all at the same time):
<!-- @remoteBuild @test --> <!-- @remoteBuild @test -->
``` ```
target=github.com/kubernetes-sigs/kustomize//examples/multibases target="https://github.com/kubernetes-sigs/kustomize//examples/multibases?ref=v1.0.6"
test 3 == \ test 3 == \
$(kustomize build $target | grep cluster-a-.*-myapp-pod | wc -l); \ $(kustomize build $target | grep cluster-a-.*-myapp-pod | wc -l); \
echo $? echo $?
``` ```
Overlays can be remote as well: A base can be a URL:
<!-- @remoteOverlayBuild @test -->
```
target=github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6
test 1 == \
$(kustomize build $target | grep cluster-a-dev-myapp-pod | wc -l); \
echo $?
```
A base can also be specified as a URL:
<!-- @createOverlay @test --> <!-- @createOverlay @test -->
``` ```
@@ -39,7 +44,10 @@ bases:
namePrefix: remote- namePrefix: remote-
EOF EOF
``` ```
Running `kustomize build $DEMO_HOME` and confirm the output contains three Pods and all have `remote-` prefix.
Build this to confirm that all three pods from the base
have the `remote-` prefix.
<!-- @remoteBases @test --> <!-- @remoteBases @test -->
``` ```
test 3 == \ test 3 == \
@@ -48,6 +56,7 @@ test 3 == \
``` ```
## URL format ## URL format
The url should follow The url should follow
[hashicorp/go-getter URL format](https://github.com/hashicorp/go-getter#url-format). [hashicorp/go-getter URL format](https://github.com/hashicorp/go-getter#url-format).
Here are some example urls pointing to Github repos following this convention. Here are some example urls pointing to Github repos following this convention.