Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- mode: Python -*-

kustomize_cmd = "./hack/tools/bin/kustomize"
envsubst_cmd = "./hack/tools/bin/envsubst"

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

yaml = envsubst(yaml)
k8s_yaml(blob(yaml))


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


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

def kustomizesub(folder):
yaml = local('hack/kustomize-sub.sh {}'.format(folder), quiet=True)
return yaml

##############################
# Actual work happens here
##############################
Expand Down
21 changes: 21 additions & 0 deletions hack/kustomize-sub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

root=$(dirname "${BASH_SOURCE[0]}")
$root/tools/bin/kustomize build $1 | $root/tools/bin/envsubst