mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 01:23:48 +00:00
Regional registries: Hack the manifests!
Allow the gcr.io/google_containers registry to be overridden regionally by just blasting a new KUBE_ADDON_REGISTRY out. Instead of adding every addon to Salt and asking all of the other consumers (Trusty, Juju, Mesos, etc) to change, just script the sed ourselves. This is probably the 9th grossest thing I've ever done, but it works well, and it works quickly. I kind of wish it didn't.
This commit is contained in:
@@ -85,6 +85,19 @@ cat <<EOF >>"${docker_images_sls_file}"
|
||||
kube_docker_registry: '$(echo ${KUBE_DOCKER_REGISTRY:-gcr.io/google_containers})'
|
||||
EOF
|
||||
|
||||
# TODO(zmerlynn): Forgive me, this is really gross. But in order to
|
||||
# avoid breaking the non-Salt deployments, which already painfully
|
||||
# have to templatize a couple of the add-ons anyways, manually
|
||||
# templatize the addon registry for regional support. When we get
|
||||
# better templating, we can fix this.
|
||||
readonly kube_addon_registry="${KUBE_ADDON_REGISTRY:-gcr.io/google_containers}"
|
||||
if [[ "${kube_addon_registry}" != "gcr.io/google_containers" ]]; then
|
||||
find /srv/salt-new -name \*.yaml -or -name \*.yaml.in | \
|
||||
xargs sed -ri "s@(image:\s.*)gcr.io/google_containers@\1${kube_addon_registry}@"
|
||||
# All the legacy .manifest files with hardcoded gcr.io are JSON.
|
||||
find /srv/salt-new -name \*.manifest -or -name \*.json | \
|
||||
xargs sed -ri "s@(image\":\s+\")gcr.io/google_containers@\1${kube_addon_registry}@"
|
||||
fi
|
||||
|
||||
echo "+++ Swapping in new configs"
|
||||
for dir in "${SALTDIRS[@]}"; do
|
||||
|
Reference in New Issue
Block a user