1
1
# remote targets
2
2
3
- ` kustomize build ` can be run on a URL.
3
+ ` kustomize build ` can be run on a URL. Resources can also reference other
4
+ kustomization directories via URLs too.
4
5
5
- A [ lite version of go-getter module] ( https://github.com/yujunz/go-getter ) is
6
- leveraged to get remote content, then running ` kustomize build ` against the
7
- desired directory in the local copy.
6
+ The URL format is an HTTPS or SSH ` git clone ` URL with an optional directory and
7
+ some query string parameters. The directory is specified by appending a ` // `
8
+ after the repo URL. The following query string parameters can also be specified:
9
+
10
+ * ` ref ` - a ` git fetch ` -able ref, typically a branch, tag, or full commit hash
11
+ (short hashes are not supported)
12
+ * ` timeout ` (default ` 27s ` ) - a number in seconds, or a go duration. specifies
13
+ the timeout for fetching the resource
14
+ * ` submodules ` (default ` true ` ) - a boolean specifying whether to clone
15
+ submodules or not
16
+
17
+ For example,
18
+ ` https://github.com/kubernetes-sigs/kustomize//examples/multibases/dev/?ref=v1.0.6 `
19
+ will essentially clone the git repo via HTTPS, checkout ` v1.0.6 ` and run
20
+ ` kustomize build ` inside the ` examples/multibases/dev ` directory.
21
+
22
+ SSH clones are also supported either with
` [email protected] :owner/repo` or
23
+ ` ssh://[email protected] /owner/repo ` URLs.
24
+
25
+ ` file:/// ` clones are not supported.
26
+
27
+ # Examples
8
28
9
29
To try this immediately, run a build against the kustomization
10
30
in the [ multibases] ( multibases/README.md ) example. There's
11
31
one pod in the output:
12
32
13
33
<!-- @remoteOverlayBuild @testAgainstLatestRelease -->
14
34
```
15
- target="github.com/kubernetes-sigs/kustomize/examples/multibases/dev/?ref=v1.0.6"
35
+ target="https:// github.com/kubernetes-sigs/kustomize/ /examples/multibases/dev/?ref=v1.0.6"
16
36
test 1 == \
17
37
$(kustomize build $target | grep dev-myapp-pod | wc -l); \
18
38
echo $?
@@ -24,33 +44,21 @@ someone who wants to send them all at the same time):
24
44
25
45
<!-- @remoteBuild @testAgainstLatestRelease -->
26
46
```
27
- target="https://github.com/kubernetes-sigs/kustomize/examples/multibases?ref=v1.0.6"
47
+ target="https://github.com/kubernetes-sigs/kustomize// examples/multibases?ref=v1.0.6"
28
48
test 3 == \
29
49
$(kustomize build $target | grep cluster-a-.*-myapp-pod | wc -l); \
30
50
echo $?
31
51
```
32
52
33
- The URL can be an archive
34
-
35
- <!-- @remoteBuild -->
36
- ```
37
- target="https://github.com/kustless/kustomize-examples/archive/master.zip//kustomize-examples-master"
38
- test 1 == \
39
- $(kustomize build $target | grep remote-cm | wc -l); \
40
- echo $?
41
- ```
42
-
43
- Note the kustomize root path inside archive must be appended after ` // ` .
44
-
45
- A base can be a URL:
53
+ A remote kustomization directory resource can also be a URL:
46
54
47
55
<!-- @createOverlay @testAgainstLatestRelease -->
48
56
```
49
57
DEMO_HOME=$(mktemp -d)
50
58
51
59
cat <<EOF >$DEMO_HOME/kustomization.yaml
52
60
resources:
53
- - github.com/kubernetes-sigs/kustomize/examples/multibases?ref=v1.0.6
61
+ - https:// github.com/kubernetes-sigs/kustomize/ /examples/multibases?ref=v1.0.6
54
62
namePrefix: remote-
55
63
EOF
56
64
```
@@ -65,18 +73,16 @@ test 3 == \
65
73
echo $?
66
74
```
67
75
68
- ## URL format
69
-
70
- The url should follow
71
- [ hashicorp/go-getter URL format] ( https://github.com/hashicorp/go-getter#url-format ) .
76
+ ## Legacy URL format
72
77
73
- Note that using ` // ` in the url will only copy the directory specified by the path
74
- after ` // ` , which means some relative paths, like ` ../xxx ` , may not work. Using ` / ` to copy
75
- entire repo. For more details please see [ go-getter documentation] ( https://github.com/hashicorp/go-getter#subdirectories ) .
78
+ Historically, kustomize has supported a modified [ hashicorp/go-getter URL format] ( https://github.com/hashicorp/go-getter#url-format ) .
76
79
77
- Note that S3 and GCS are NOT supported to avoid introducing massive dependency.
80
+ This is still supported for backwards compatibility but is no longer recommended
81
+ to be used as kustomize supports different query parameters and the semantics of
82
+ what gets fetched in ` go-getter ` itself are different (particularly with
83
+ subdirectories).
78
84
79
- Here are some example urls
85
+ Here are some examples of legacy urls
80
86
81
87
<!-- @createOverlay @testAgainstLatestRelease -->
82
88
```
@@ -92,7 +98,5 @@ resources:
92
98
- github.com/Liujingfang1/kustomize/examples/helloWorld?ref=repoUrl2
93
99
# a subdirectory in a repo on commit `7050a45134e9848fca214ad7e7007e96e5042c03`
94
100
- github.com/Liujingfang1/kustomize/examples/helloWorld?ref=7050a45134e9848fca214ad7e7007e96e5042c03
95
- # a subdirectory in a remote archive
96
- - https://github.com/kustless/kustomize-examples/archive/master.zip//kustomize-examples-master
97
101
EOF
98
102
```
0 commit comments