mirror of https://github.com/k3s-io/k3s
Add 'ETCD_DOCKER_REPOSITORY' environment variable override to 'cluster/' scripts.
This allows the etcd docker registry that is currently hard coded to `gcr.io/google_containers/etcd` in the `etcd.manifest` template to be overridden. This can be used to test new versions of etcd with kubernetes that have not yet been published to `gcr.io/google_containers/etcd` and also enables cluster operators to manage the etcd images used by their cluster in an internal repository.pull/6/head
parent
ec116fdc73
commit
2e362ea142
|
@ -828,6 +828,12 @@ EOF
|
||||||
if [ -n "${ETCD_IMAGE:-}" ]; then
|
if [ -n "${ETCD_IMAGE:-}" ]; then
|
||||||
cat >>$file <<EOF
|
cat >>$file <<EOF
|
||||||
ETCD_IMAGE: $(yaml-quote ${ETCD_IMAGE})
|
ETCD_IMAGE: $(yaml-quote ${ETCD_IMAGE})
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
# ETCD_DOCKER_REPOSITORY (if set) allows to use a custom etcd docker repository to pull the etcd image from.
|
||||||
|
if [ -n "${ETCD_DOCKER_REPOSITORY:-}" ]; then
|
||||||
|
cat >>$file <<EOF
|
||||||
|
ETCD_DOCKER_REPOSITORY: $(yaml-quote ${ETCD_DOCKER_REPOSITORY})
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
# ETCD_VERSION (if set) allows you to use custom version of etcd.
|
# ETCD_VERSION (if set) allows you to use custom version of etcd.
|
||||||
|
|
|
@ -146,6 +146,7 @@ HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
|
||||||
# Set etcd image (e.g. gcr.io/google_containers/etcd) and version (e.g. 3.1.10) if you need
|
# Set etcd image (e.g. gcr.io/google_containers/etcd) and version (e.g. 3.1.10) if you need
|
||||||
# non-default version.
|
# non-default version.
|
||||||
ETCD_IMAGE="${TEST_ETCD_IMAGE:-}"
|
ETCD_IMAGE="${TEST_ETCD_IMAGE:-}"
|
||||||
|
ETCD_DOCKER_REPOSITORY="${TEST_ETCD_DOCKER_REPOSITORY:-}"
|
||||||
ETCD_VERSION="${TEST_ETCD_VERSION:-}"
|
ETCD_VERSION="${TEST_ETCD_VERSION:-}"
|
||||||
|
|
||||||
# Default Log level for all components in test clusters and variables to override it in specific components.
|
# Default Log level for all components in test clusters and variables to override it in specific components.
|
||||||
|
|
|
@ -480,6 +480,11 @@ EOF
|
||||||
if [ -n "${ETCD_IMAGE:-}" ]; then
|
if [ -n "${ETCD_IMAGE:-}" ]; then
|
||||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
etcd_docker_tag: '$(echo "$ETCD_IMAGE" | sed -e "s/'/''/g")'
|
etcd_docker_tag: '$(echo "$ETCD_IMAGE" | sed -e "s/'/''/g")'
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [ -n "${ETCD_DOCKER_REPOSITORY:-}" ]; then
|
||||||
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
|
etcd_docker_repository: '$(echo "$ETCD_DOCKER_REPOSITORY" | sed -e "s/'/''/g")'
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ -n "${ETCD_VERSION:-}" ]; then
|
if [ -n "${ETCD_VERSION:-}" ]; then
|
||||||
|
|
|
@ -803,6 +803,11 @@ function prepare-etcd-manifest {
|
||||||
else
|
else
|
||||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "${ETCD_DOCKER_REPOSITORY:-}" ]]; then
|
||||||
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@${ETCD_DOCKER_REPOSITORY}@g" "${temp_file}"
|
||||||
|
else
|
||||||
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
||||||
|
|
|
@ -1194,6 +1194,11 @@ function prepare-etcd-manifest {
|
||||||
else
|
else
|
||||||
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "${ETCD_DOCKER_REPOSITORY:-}" ]]; then
|
||||||
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@${ETCD_DOCKER_REPOSITORY}@g" "${temp_file}"
|
||||||
|
else
|
||||||
|
sed -i -e "s@{{ *pillar\.get('etcd_docker_repository', '\(.*\)') *}}@\1@g" "${temp_file}"
|
||||||
|
fi
|
||||||
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
|
||||||
if [[ -n "${ETCD_VERSION:-}" ]]; then
|
if [[ -n "${ETCD_VERSION:-}" ]]; then
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"containers":[
|
"containers":[
|
||||||
{
|
{
|
||||||
"name": "etcd-container",
|
"name": "etcd-container",
|
||||||
"image": "gcr.io/google_containers/etcd:{{ pillar.get('etcd_docker_tag', '3.1.10') }}",
|
"image": "{{ pillar.get('etcd_docker_repository', 'gcr.io/google_containers/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.1.10') }}",
|
||||||
"resources": {
|
"resources": {
|
||||||
"requests": {
|
"requests": {
|
||||||
"cpu": {{ cpulimit }}
|
"cpu": {{ cpulimit }}
|
||||||
|
|
Loading…
Reference in New Issue