Skip to content

Commit 9dec43b

Browse files
authored
Merge pull request #829 from jsturtevant/fix-tilt-up-on-linux
Handle large yaml files on linux in tilt config
2 parents bceee96 + c367ab8 commit 9dec43b

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

Tiltfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- mode: Python -*-
22

3-
kustomize_cmd = "./hack/tools/bin/kustomize"
43
envsubst_cmd = "./hack/tools/bin/envsubst"
54

65
update_settings(k8s_upsert_timeout_secs=60) # on first tilt up, often can take longer than 30 seconds
@@ -152,7 +151,7 @@ COPY manager .
152151
# Build CAPZ and add feature gates
153152
def capz():
154153
# Apply the kustomized yaml for this provider
155-
yaml = str(kustomize("./config"))
154+
yaml = str(kustomizesub("./config"))
156155
substitutions = settings.get("kustomize_substitutions", {})
157156
for substitution in substitutions:
158157
value = substitutions[substitution]
@@ -200,7 +199,6 @@ def capz():
200199
ignore = ["templates"]
201200
)
202201

203-
yaml = envsubst(yaml)
204202
k8s_yaml(blob(yaml))
205203

206204

@@ -333,11 +331,14 @@ def base64_decode(to_decode):
333331
decode_blob = local("echo '{}' | base64 --decode -".format(to_decode), quiet=True)
334332
return str(decode_blob)
335333

336-
337334
def envsubst(yaml):
338335
yaml = yaml.replace('"', '\\"')
339336
return str(local("echo \"{}\" | {}".format(yaml, envsubst_cmd), quiet=True))
340337

338+
def kustomizesub(folder):
339+
yaml = local('hack/kustomize-sub.sh {}'.format(folder), quiet=True)
340+
return yaml
341+
341342
##############################
342343
# Actual work happens here
343344
##############################

hack/kustomize-sub.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Copyright 2018 The Kubernetes Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o errexit
17+
set -o nounset
18+
set -o pipefail
19+
20+
root=$(dirname "${BASH_SOURCE[0]}")
21+
$root/tools/bin/kustomize build $1 | $root/tools/bin/envsubst

0 commit comments

Comments
 (0)